Practice
The reason for this is that
Let's say the initial value of a counter is zero. After three consecutive increment operations, the value will only be incremented by one.
// assuming this.state.count === 0
this.setState({ count: this.state.count + 1 })
this.setState({ count: this.state.count + 1 })
this.setState({ count: this.state.count + 1 })
// this.state.count === 1, not 3
If we pass a function to setState()Sign in and the lectures you have studied will be marked in this list.
Choose a course
Comments