The most common React mistake
Dmitri Pisarev 🇷🇺
Posted on May 15, 2020
Have you ever ran into this warning?
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.
I bet this is the most common ReactJS newbie mistake... Forgetting to clean up your effects.
Stumbled over it again and here's how I fixed it: https://github.com/dimaip/calendar/commit/c20274917feff86af859f7252b717b84936ba865
💖 💪 🙅 🚩
Dmitri Pisarev 🇷🇺
Posted on May 15, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
undefined Exploring the React component lifecycle: A guide to understanding the different phases.
November 29, 2024