title: React Hooks State update one step behind. For this reason my changes are not working correctly
body: <p>I want to see the changes in the use of react hooks on state immediately. My changes are one step behind on state. How can I solve this.</p>
  <pre><code>const [categoryID, setCategoryID] = useState(0);
  
  const changeCategory = (e) =&gt; {
      setCategoryID(e.target.value);
      console.log(categoryID);
    };
  
  &lt;Field
       as=&quot;select&quot;
       onChange={changeCategory}
       style={formStyle().inputStyle}
       className=&quot;form-control&quot;
       type=&quot;text&quot;
       name=&quot;categoryID&quot;
        &gt;
  </code></pre>
  <p>When I select the first value, the result appears 0. If I chose my second value, I see the value I chose first on the console.</p>