title: State doesn't change how i want it
body: <p>I would like to change my state in the same function from true to false and after some code ran change it back to true but when I console.log() the state it shows me that the state never changed. What am I missing here?</p>
  <pre><code>import { useState } from &quot;react&quot;
  
  const Test = () =&gt; {
    const [someState, setSomeState] = useState(true)
  
    const testState = () =&gt; {
      setSomeState(false)
      console.log(someState)
      console.log(&quot;do something&quot;)
      setSomeState(true)
      console.log(someState)
    }
  
    return &lt;button onClick={testState}&gt;test&lt;/button&gt;
  }
  
  export default Test
  </code></pre>