title: react when use useeffect for unmount , data not change
body: <p>i use this code in my react project 
  when change data1 with usestate , i see data1 is change to 1 but when unmount component data1 is default  value 0 .
  whats wrong?
  code is:</p>
  
  <pre><code>useEffect( () =&gt; console.log( ["mount",data1] ), [] );
  useEffect( () =&gt; console.log( ["will update",data1] ) );
  useEffect( () =&gt; () =&gt; console.log( ["unmount",data1] ), [] );
  </code></pre>
  
  <p>log when mount and change is:</p>
  
  <pre><code>["mount", "0"]
  ["will update", "0"]
  ["will update", "2"]
  ["unmount", "0"]
  </code></pre>