JavaScript React Components Stateful Components and Lifecycle Methods Update the Stopwatch State with componentDidMount()

Brian Hoang
Brian Hoang
11,515 Points

setState in handleStopwatch()

The fact that in the video "!this.state.isRunning" is evaluated to "true" and console logs "starting..." the first time Guil clicks the start button implies that the isRunning state was not changed by setState before the "if(!this.state.isRunning)" line

Should I from now on assume the effect of setState method is not immediate, at least in the function it was called?