i have state like this
state = {
params: {}
}
let say we set the params by this.setState({params:{data:2}})
then when we want to revert back to its initial state we call this.setState({params:{}})
. The state is reverted, but the problem is that the view still render 2 (value of this.state.params.data). The only way that working is i call this.setState({params:{data:''}})
. Imagine if we have many fields, we wont't do that. Is there any solution?
Link for codesandbox is here