Reactjs-setState previous state is the first argument, props as the second argument
They say you should do like that instead of the below example. // Wrong this.setState({ counter: this.state.counter + this.props.increment, }); They can’t assure the state will have the correct value if you access like this because setState() will happen asynchronously, other updates could occur and change the value. If you are going to calculate the … Read more