title: Why my useEffect that tries to get blockchain data is looping infinitely and my async func still returns Promise pending
body: <p>I am trying to use async await inside a useEffect hook getting some data from a testnet blockchain but I am getting 2 problems:</p>
  <ol>
  <li>The async function returns a Promise, why is that? Shouldn't async await automatically resolve the promise and give me the data? I tried to solve it with Promise.resolve but not working, it still tells me campaigns is a Promise in pending state.</li>
  <li>It enters in an infinite loop and I still do not get why.</li>
  </ol>
  <p>Here is the code:</p>
  <pre><code>  useEffect(() =&gt; {
      const getCampaigns = async() =&gt; {
        const campaigns = await factory.methods.getDeployedCampaigns().call()
        return campaigns
      }
      const campaigns = getCampaigns();
      setCampaigns(Promise.resolve(campaigns));
  
      console.log('campaigns: ', campaigns);
    })
  </code></pre>