Mount Warning

Hi Wizards :mage:,

using useEffect() i am getting a warning when i try to set something in state .

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    in Unknown

What i am trying to do?
fetching data from an external source after user is authenticated and landed on dashboard.

Could you please share the code of that component?

Dan Abramov (one of the React core devs) recommends this approach: https://github.com/facebook/react/issues/14369#issuecomment-468267798

useEffect(() => {
  let didCancel = false;
 
  // ...
  // you can check didCancel
  // before running any setState
  // ...
 
  return () => {
    didCancel = true; // This function is executed on unmount.
  };
}, []);