title: What is the expected return of `useEffect` used for?
body: <p>In the React <a href="https://reactjs.org/docs/hooks-faq.html#is-it-safe-to-omit-functions-from-the-list-of-dependencies" rel="noreferrer">documentation</a> for hooks they say:</p>
  
  <blockquote>
    <p>"This also allows you to handle out-of-order responses with a local
    variable inside the effect"</p>
  </blockquote>
  
  <pre><code>useEffect(() =&gt; {
      let ignore = false;
      async function fetchProduct() {
        const response = await fetch('http://myapi/product/' + productId);
        const json = await response.json();
        if (!ignore) setProduct(json);
      }
  
      fetchProduct();
      return () =&gt; { ignore = true };
    }, [productId]);
  </code></pre>
  
  <p><a href="https://codesandbox.io/s/jvvkoo8pq3" rel="noreferrer">Demo app</a></p>
  
  <p>Please help me understand this better by explaining:</p>
  
  <ol>
  <li>Why is the return a function? <code>return () =&gt; { ignore = true };</code></li>
  <li>What is ignored used for in this example?</li>
  </ol>
  
  <p>Thanks!</p>