this.state = this.emptyState;
}
+ static getDerivedStateFromProps(props) {
+ return {
+ type_: props.type_,
+ };
+ }
+
render() {
return (
<div class="btn-group btn-group-toggle">
{i18n.t('posts')}
</label>
<label
- className={`pointer btn btn-sm btn-secondary ${this.state.type_ ==
- DataType.Comment && 'active'}`}
+ className={`pointer btn btn-sm btn-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));
}
}
this.state = this.emptyState;
}
+ static getDerivedStateFromProps(props) {
+ return {
+ type_: props.type_,
+ };
+ }
+
render() {
return (
<div class="btn-group btn-group-toggle">
{i18n.t('subscribed')}
</label>
<label
- className={`pointer btn btn-sm btn-secondary ${this.state.type_ ==
- ListingType.All && 'active'}`}
+ className={`pointer btn btn-sm btn-secondary ${
+ this.state.type_ == ListingType.All && 'active'
+ }`}
>
<input
type="radio"
}
handleTypeChange(i: ListingTypeSelect, 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));
}
}
this.state = this.emptyState;
}
+ static getDerivedStateFromProps(props) {
+ return {
+ sort: props.sort,
+ };
+ }
+
render() {
return (
<>
}
handleSortChange(i: SortSelect, event: any) {
- i.state.sort = Number(event.target.value);
- i.setState(i.state);
- i.props.onChange(i.state.sort);
+ i.props.onChange(event.target.value);
}
}