24

1 bug, 2 hours.
Just from
this.setState({list : list})
To
this.setState({list : [...list]})
OMG...

Comments
  • 0
    Ah the spread operator strikes again
  • 2
    Been there, cried there...
  • 0
    @irene Object and Array are pass by reference in JavaScript. State in React is immutable means I should assign value to state instead of reference. Spread operator is a new simple way to deepClone Array. Hummm... I'm confused....
Add Comment