. Advertisement .
..3..
. Advertisement .
..4..
I encounter ”Cant perform a react state update on an unmounted component” error when fetching of data is started and the component was unmounted, but the function is trying to update the state of the unmounted component.
Can't perform a React state update on an unmounted component.
I searched the solutions on some websites, but I didn’t get it. I appreciate your assistance!
The cause: This error mesage implies that your application has a memory leak.
The solution: You can fix this error by using a local variable to track whether or not the component is mounted.For Example: