an't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. code example
Example 1: 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.
## Description
This issue usually happens when you're trying to apply state
changes to a component that does not exists anymore.
Often happens when the component gets removed from a tree
while there is a promise running in one of it's lifecycles.
The best way to fix it is to make sure that if there is any
promises in your component lifecycle, it should abort those
once the component gets unmounted from the tree.
Here is an interesting article that gives you a reproduction of this
error together with one type of solution https://www.debuggr.io/react-update-unmounted-component/
Example 2: react warning can't perform a react state update on an unmounted component
componentWillUnmount() {
this.setState = (state,callback)=>{
return;
};
}