title: Awaiting status update from API with React Hooks (useEffect)?
body: <p>I am trying to achieve the following:</p>
  <p>Using React + React Hooks + useEffect</p>
  <ol>
  <li>Make an API post request</li>
  <li>Receiving an ID</li>
  <li>Making another post request using the ID to get the status (Queued or Completed)</li>
  </ol>
  <p>So basically</p>
  <pre><code>{
    id: &quot;xxxxxxx&quot;,
    status: &quot;queued&quot;
  }
  </code></pre>
  <p>Is what I get back. Now the processing time varies, but I want to periodically check if the status has changed from &quot;queued&quot; to &quot;completed&quot;. And while it's not completed, I want to display a loading spinner.</p>
  <p>What would be the best way to do this? Would this be possible with promises / async functions? Or do I have to use some kind of interval to re-check the status periodically?</p>
  <p>I am basically trying to use this in React: <a href="https://docs.assemblyai.com/walkthroughs#authentication" rel="nofollow noreferrer">https://docs.assemblyai.com/walkthroughs#authentication</a></p>