title: Cannot update parent state on clean up child component
body: <p>cannot reset value on unmount. On mount, it can setValue {a:2}. but on unmount component, setValue is not resetting value,</p>
  <pre><code>const Child = ({setValue}) =&gt; {
    useEffect(() =&gt; {
      setValue({a:2})
  
      //clean up on unmount
      return () =&gt; {
        console.log('cleanup');
        setValue({});
      };
    }, []);
   }
  </code></pre>
  <p>In parent</p>
  <pre><code> const Parent = () =&gt; {
     const [value, setValue ] = useState({})
     console.log(value) // returns {a:2} even after unmounting child
  }
  </code></pre>
  <p>component unmounted and clean up also called console.log('cleanup'); but setValue can't reset.</p>