title: Losing state inside eventHandler
body: <pre class="lang-js prettyprint-override"><code>const [page,setPage] = useState()
  
  console.log(page) // gives &quot;Page1&quot; upon state update
  const onValueChange = (event) =&gt; {
      console.log(page); //gives undefined upon state update
  };
  
  &lt;Input
  onChange={(e) =&gt; onValueChange(e)}         
  /&gt;
  
  &lt;SelectDropdown
  onChange={() =&gt; setPage(&quot;Page1&quot;)}
  value={page}
  /&gt;
  </code></pre>
  <p>Above code is a brief example on how I cant access the state &quot;page&quot; inside the function from an eventHandler, how is it possible to access the state inside <code>onValueChange()</code>.</p>