title: How can I access the data in a promise that is pending?
body: <p>I am looking to return an array in a promise but it keeps saying promise pending. It is returning promise: fulfilled and promise value: array. I have read the documentation and the thread on here about promises and have tried to use it as a function. I have tried to use async await but nothing seems to be working. I read somewhere that you can store it in a global variable, is that the case. Or is you can't store it in a global variable when you use React, because I am using React. Can someone point me in the right direction?</p>
  <p>Here's my code:</p>
  <pre><code>const currentSymbol = fetch(`https://finnhub.io/api/v1/stock/symbol?exchange=US&amp;token=${key}`)
      .then((res) =&gt; {
          return res.json();
      }).then((results) =&gt; {
          return results.map(result =&gt; {
              return result
          })
      })
  
  console.log(currentSymbol)
  </code></pre>