this.state = this.emptyState;
}
+ static getDerivedStateFromProps(props: any): DataTypeSelectProps {
+ return {
+ type_: props.type_,
+ };
+ }
+
render() {
return (
- <div class="btn-group btn-group-toggle">
+ <div class="btn-group btn-group-toggle flex-wrap mb-2">
<label
- className={`pointer btn btn-sm btn-secondary
+ className={`pointer btn btn-outline-secondary
${this.state.type_ == DataType.Post && 'active'}
`}
>
{i18n.t('posts')}
</label>
<label
- className={`pointer btn btn-sm btn-secondary ${this.state.type_ ==
- DataType.Comment && 'active'}`}
+ className={`pointer btn btn-outline-secondary ${
+ this.state.type_ == DataType.Comment && 'active'
+ }`}
>
<input
type="radio"
}
handleTypeChange(i: DataTypeSelect, event: any) {
- i.state.type_ = Number(event.target.value);
- i.setState(i.state);
- i.props.onChange(i.state.type_);
+ i.props.onChange(Number(event.target.value));
}
}