37
rated 0 times
[
39]
[
2]
/ answers: 1 / hits: 36511
/ 6 Years ago, fri, july 20, 2018, 12:00:00
When I want to copy the state like this:
let copy = this.state.foo
copy.push('bar')
the state copied correctly, but with its reference, and when I change 'copy' the main state changes.
What should I do to avoid this change?
More From » reactjs