title: when does useEffect fire in componentWillUnmount?
body: <p>I read below statement in a blog, it says something like this</p>
  
  <pre><code>useEffect(() =&gt; {
    API.getUser(userId);
  }, [userId]);
  </code></pre>
  
  <blockquote>
    <p>Optionally the second parameter can also just be an empty array, in
    this case it will only execute on <code>componentDidMount</code> and
    <code>componentWillUnmount</code> and the effect won't run on <code>componentDidUpdate</code>.</p>
  </blockquote>
  
  <p>Does the <code>API.getUser</code> got executed when the component got unmounted (<code>componentWillUnmount</code>)? as I know <code>componentWillUnmount</code> trigger when you go from page A to page B. I'm confused now, for me, above code act like <code>componentDidMount</code>, because <code>userId</code> will change from <code>undefined</code> to <code>id</code> once. </p>