title: Can a useMemo memoized value be updated with useEffect from within the component?
body: <p>I'm trying to render data that must be passed through <code>useMemo</code>. I get the data from an api call so I call <code>useEffect</code>. The initial render works returning an empty array but once I call the api, data is not updated.</p>
  <pre><code>import React from 'react'
  import {fetchAccounts} from '../utils/api'
  
  export default function Accounts() {
      const [accounts, setAccounts] = React.useState([])
  
  React.useEffect(() =&gt; {
      setLoading(true)
      fetchAccounts().then((data) =&gt; {
          setAccounts(data)
      })
  }, [])
  const data = React.useMemo(() =&gt; accounts, [])
  
  return &lt;p&gt;{JSON.stringify(data)}&lt;/p&gt;}
  </code></pre>
  <p>So can this work within a single component? Or must a custom hook be created?</p>