title: React - UseEffect enforce execution order
body: <p>I'm new to React and I'm using React + Redux (+django DRF) and JWT authentication with refresh.</p>
  <p>I created an action <code>refreshToken </code> so that when this action is called, if the refresh token is still valid, it makes a post request to obtain a new pair of tokens. (if the token is expired then the user is logged out).</p>
  <p>Now, I want this to be executed before I send a request to any of my api routes that require authentication.</p>
  <p>I'm calling the refresh action with dispatch in useEffect, before calling the protected api. However, most times, the request for the protected api <code>myProtectedGETapi </code> is executed before my <code>refreshToken </code> action.</p>
  <pre><code>useEffect(() =&gt; {
          
          if (userInfo &amp;&amp; userInfo.isAdmin ){
              dispatch(refreshToken())
              dispatch(myProtectedGETapi())
          }else{
              navigate('/login')
          }
  
      },[dispatch, navigate, userInfo])
  </code></pre>
  <p>So I would like to enfore an execution order within useEffect, so to first check and refresh the token, and then execute the second api call</p>
  <p>Is this possible?
  Or what is the best practice to implement this logic in React+Redux ?</p>