title: Fetch returns undefined when imported
body: <p>I have a function that fetches data from the url and is supposed to return it: </p>
  
  <pre><code>const fetchTableData = () =&gt; {
  fetch('https://api.myjson.com/bins/15psn9')
      .then(result =&gt; result.json())
      .then(data =&gt; {
          return data;
      })
  }
  
  export default fetchTableData;
  </code></pre>
  
  <p>The problem is that when i import this function and try to use it, it always returns <code>undefined</code>.</p>
  
  <p>When i console log the data inside the function itself, you can see it is available. The function just doesn't work when i try to import it.</p>
  
  <p>What is the problem here? Why does it work that way?</p>