title: Update array using useState
body: <p>I'm calling an API inside the useEffect hook and trying to update my state <code>covidData</code> but my array remains empty even after calling the setData function:</p>
  <pre><code>const [covidData, setData] = useState([]);
  
  useEffect(() =&gt; {
          async function getGlobalData() {
  
              let response = await fetch('https://api.covid19api.com/summary');
              let jsonResponse = await response.json();
              const globalData = jsonResponse.Global;
  
              //setting covidData
              setData([...covidData, {recovered: globalData.TotalRecovered}])
              console.log(covidData); //covidData is empty
          }
  
          getGlobalData()
      }, [])
  </code></pre>
  <p>what am I doing wrong?</p>