Why React useEffect is not unmounting

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');  };}, []);
Async useEffect is pretty much unreadable · Issue #14326 · facebook/react
The only alternative is using then() chains which aren’t very readable at their own.

This link explains how you have to properly call the side effect.

Hope this helped someone.

safaldas

safaldas