title: useState() undefined in React just after set
body: <p>I have a problem and I do not undersatnd why the hook return undefined :</p>
  <pre><code>import React, { useEffect, useState } from 'react';
  
  
  function App(){
  
      const [globalVariable, setGlobalVariable] = useState();
  
    useEffect(()=&gt;{
  
      const test = 5
      console.log(test) // return 5
      setGlobalVariable(test)
      console.log(globalVariable) // return undefined
      
      
      },[]);
    
    
  
    return (
      &lt;div&gt;
      &lt;/div&gt;
    );
  }
  
  export default App;
  </code></pre>
  <p>How can I do in order to set directly a new value for the globalVariable ?</p>