Top useEffect mistakes made by React Developers
- Jun 13, 2023
useEffect is a kind of “escape hatch” which lets you perform side effects in functional components.
Effects let you step outside of React, giving you the ability to synchronise your components with systems that aren’t controlled by React such as a non-react widget, an external system (such as a browser API), a third party library, or a network connection.
Effects aren’t always necessary; if there is no external system involved, you shouldn’t need useEffect.
But it isn’t always clear when effects are necessary, and how to use them. Which leads to some common mistakes.
Here are some of the top mistakes that I’ve seen people make with useEffect: