title: How to use useMemo with an external API?
body: <p>I'm working with <code>react-table</code> library for filtering and pagination. I am requesting data from a custom API using <code>Node</code> and rendering it using <code>useTable</code> hook from <code>react-table</code>. The documentation for <code>react-table</code> says the table data should be memoized, so I use the <code>useMemo</code> hook. The code is as shown:</p>
  <pre><code>  const data = React.useMemo(() =&gt; {
      axios.get(&quot;/custom/api/endpoint&quot;)
        .then((res) =&gt; {
          return res.data;   //Returns an array of objects
        })
        .catch((err) =&gt; {
          console.log(&quot;err&quot;);
        });
    }, []);
  </code></pre>
  <p>However, I am getting the following error:</p>
  <pre><code>Uncaught TypeError: Cannot read property 'forEach' of undefined
      at accessRowsForColumn (useTable.js:591)
      at useTable.js:195
      .
      .
  </code></pre>
  <p>Can anyone help me figure this? Thanks in advance!</p>