this.state = {
qs: {catName:'',subCatName:''}
}
I have the above nested state object. In order to setState, I used the below code in componentDidUpdate.
var newQs = {...this.state.qs}
newQs.catName = 'name';
this.setState({qs: newQs});
But it does not working, still this.state.qs is empty not updated. I even tried the following one.
this.setState({...this.state, qs: {
...this.state.qs,
catName: 'name'
}});
Still not works.