loading...

re: Better ReactJS patterns: this.setState pitfalls VIEW POST

FULL DISCUSSION
 

Actually you can do:

incrementCounter = () => {
  this.setState((presentState) => (
    { ...presentState, counter: ++presentState.counter }
  ))
}
 

You are right, thanks for catching that

code of conduct - report abuse