DataTypeSelectProps,
DataTypeSelectState
> {
- private emptyState: DataTypeSelectState = {
+ state: DataTypeSelectState = {
type_: this.props.type_,
};
constructor(props: any, context: any) {
super(props, context);
- this.state = this.emptyState;
}
static getDerivedStateFromProps(props: any): DataTypeSelectProps {
render() {
return (
- <div class="btn-group btn-group-toggle flex-wrap mb-2">
+ <div className="data-type-select btn-group btn-group-toggle flex-wrap">
<label
className={`pointer btn btn-outline-secondary
${this.state.type_ == DataType.Post && "active"}
>
<input
type="radio"
+ className="btn-check"
value={DataType.Post}
checked={this.state.type_ == DataType.Post}
onChange={linkEvent(this, this.handleTypeChange)}
>
<input
type="radio"
+ className="btn-check"
value={DataType.Comment}
checked={this.state.type_ == DataType.Comment}
onChange={linkEvent(this, this.handleTypeChange)}
}
handleTypeChange(i: DataTypeSelect, event: any) {
- i.props.onChange(Number(event.target.value));
+ i.props.onChange?.(Number(event.target.value));
}
}