title: React usestate not updating on first Click Or on First time
body: <p>Please, See this - <a href="https://codesandbox.io/s/morning-grass-z8qrq" rel="nofollow noreferrer">https://codesandbox.io/s/morning-grass-z8qrq</a></p>
  <p><a href="https://codesandbox.io/s/blue-flower-wl92u" rel="nofollow noreferrer">https://codesandbox.io/s/blue-flower-wl92u</a></p>
  <p>** the second click, third, fourth, fifth click - menuOpen is true, then again click false -  behaves as expected**</p>
  <pre><code>let [menuOpen, setMenuOpen] = useState(false);
  
  &lt;div
      onClick={() =&gt; {
      // setMenuOpen(true);
  
      setMenuOpen(!menuOpen); // I's not updated in the First time.
  
      console.log(menuOpen); // First time: false // not updating
  &gt;
   .......// some code
  &lt;/div&gt;
  </code></pre>
  <p>Please give me, some answers. I have been trying to solve this problem for Two days. I just can't solve it.</p>