I have declared state
like this,
this.state = { filtersEnabled: false}
and later I destructured
this object as follows,
let { filtersEnabled } = this.state;
Now, I want to change the value of filtersEnabled
,
filtersEnabled = true
when I do console.log(this.state.filtersEnabled)
, The answer is => false
,
But If I change the value as follows
this.state.filtersEnabled = true
Now if I do when I do console.log(this.state.filtersEnabled)
, The answer is => true
,
What's the problem here,
1.con't we do any assignment to destructured
variables? or
2.con't we do any assignment to destructured
state variables?