Recently I faced a problem where my useEffect is not triggering the unmount code which is the return function. Reason is that there was an async call for some stupid reason.
useEffect(() => { return () => { console.log('cleanup'); };}, []);
This link explains how you have to properly call the side effect.
Hope this helped someone.