title: Returning a function in useEffect
body: <p>I'm trying to understand why returning a function inside useEffect hook executes during the second time. For example:</p>
  <pre><code>const App = (props) =&gt; {
    const [change, setChange] = useState(false);
  
    useEffect(() =&gt; {
      return () =&gt; console.log(&quot;CHANGED!&quot;);
    }, [change]);
  
    return (
      &lt;div&gt;
        &lt;button onClick={() =&gt; setChange(true)}&gt;CLICK&lt;/button&gt;
      &lt;/div&gt;
    );
  };
  </code></pre>
  <p>The first time the component renders, 'CHANGED' is not being logged, but after I click the button, it does. Does anyone know why?</p>