I have a React component that passes a value (e) into a filter, e will always be one of these values: {true, false, SHOW_ALL}.
filterItem(e) {
this.state.filter[0].Status = e.target.value;
this.setState({
filter: this.state.filter
});
}
React is complaining that I am modifying state directly. Getting this warning: Do not mutate state directly. Use setState()
I can't figure out how to set the filter status to the e.target.value, AND include in the assign inside setState(); To set the status I have to assign e.target.value to the Status property like so:
this.state.filter[0].Status = e.target.value;