title: why does the setstate callback function need to be an arrow function?
body: <p>take this scenario</p>
  
  <pre><code>this.setState({ number: newNumber}, () =&gt; console.log(number))
  </code></pre>
  
  <p>and then this one:</p>
  
  <pre><code>this.setState({ number: newNumber}, console.log(number))
  </code></pre>
  
  <p>the first one (with the arrow) correctly logs the new state, the second (without the arrow) seems to console.log it one step behind.</p>
  
  <p>why does the arrow function cause it to be correct in the setState callback?</p>