Can't perform a React state update on an unmounted component
See original GitHub issueSeeing this error when I hide a div that contains many ChipSet components.
index.js:1452 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 the componentWillUnmount method.
in RippledComponent
in div
in ChipSet
It seems to happen right before execution of this line:
I see there is no “mounted” check prior to this setState
call, maybe this could be the source of error.
Issue Analytics
- State:
- Created 5 years ago
- Comments:17 (2 by maintainers)
Top Results From Across the Web
Can't perform a React state update on an unmounted ...
Here is a simple solution for this. This warning is due to when we do some fetch request while that request is in...
Read more >Can't perform a react state update on an unmounted component
To solve the "Warning: Can't perform a React state update on an unmounted component", declare an isMounted boolean in your useEffect hook that...
Read more >React: Prevent state updates on unmounted components
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...
Read more >Can't perform a react state update on an unmounted component
Fix-1: Moving the state to a higher component in the hierarchy · Fix-2: Check if React has unmounted the component using the useRef...
Read more >React state update on an unmounted component - debuggr.io
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...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fix it with this technique.
Look where I added
_isMounted
and follow the same in you code@mohokh67 What about solution for a functional component?