title: Using state after dispatch has fired
body: <p>I need to be able to preform an action right after I update my useReducer state with dispatch. But dispatch runs async so when I run my next piece of code, it uses the old state before dispatch was supposed to update it.</p>
  
  <p>What I've tried is using useEffect(()=>{},[state]), but that just runs every time state updates. I need to preform certain actions based on conditions... not just every time state updates.</p>
  
  <pre><code>// Let's update some stuff on the server with new data!
    const handleFinishOrder = () =&gt; {
  
      dispatch({ type: "finish-order", payload: id }); // Set some fields to null
  
      socket.emit("request-update-live-data", state); // Old state gets sent to server :(
    };
  </code></pre>
  
  <p>I expect the state to be updated when I go emit it off to the server but the actual state that gets sent is the old state.</p>