title: How to trigger unmounting of functional components while testing?
body: <p>I used &quot;useEffect&quot; to achieve functionality of &quot;componentWillUnmount&quot; in functional component. How to trigger that while testing the component using Jest/Enzyme?</p>
  <p>My Component:</p>
  <pre><code>const myComp = () =&gt; {
    useEffect(() =&gt; () =&gt; {
      console.log('Unmounted');
    }, []);
    return &lt;div&gt;Test&lt;/div&gt;;
  }
  </code></pre>