title: setTimeout for this.state vs useState
body: <p>When I use class component, I have code:</p>
  <pre><code>setTimeout(() =&gt; console.log(this.state.count), 5000);
  </code></pre>
  <p>When I use hook:</p>
  <pre><code>const [count, setCount] = useState(0);
  setTimeout(() =&gt; console.log(count), 5000);
  </code></pre>
  <p>If I trigger <code>setTimeout</code> then change the <code>count</code> to 1 before the timeout (<code>5000ms</code>), class component will <code>console.log(1)</code> (the newest value), and for <code>useState</code> it is <code>console.log(0)</code> (value when register timeout).<br />
  Why does this happen?</p>