title: useEffect or useMemo for API functions?
body: <p>which is the best hook for dispatching API calls in a component. Usually I use useMemo for calling the API on the first render, and useEffect if I need extra side effects, is this correct?  Becouse sometimes I get the following error:</p>
  <p>'''index.js:1 Warning: Cannot update a component (<code>Inscriptions</code>) while rendering a different component (<code>PaySummary</code>). To locate the bad setState() call inside <code>PaySummary</code>, follow the stack trace as described in ...''''</p>
  <p>That happens when I route to a component and rapidly change to another one, it doesn't &quot;affect&quot; the general behaivour becouse if i go back to the previous component it renders as expected correctly. So how should I do it?</p>