The problem with useEffect

Published: 13 December 2023
on channel: Cosden Solutions
34,349
1.6k

Join The Discord! → https://discord.cosdensolutions.io
VSCode Theme | Font → Material Theme Darker | Menlo, Monaco "monospace"

Let's talk about useEffect in React for a bit. There is a real problem with useEffect that we, as React developers, need to address. useEffect doesn't make it easy for us to follow its rules correctly, and that usually leads to developers taking shortcuts and shipping bugs in production. The rule is this: anything that is used in the useEffect is considered a dependency and has to go in the dependency array. It's the rule. If you have to wrap the dependency in a useMemo or useCallback, then you have to do it. Don't ignore it like many developers do and don't disable eslint! It's going to come back and get you later!


Watch video The problem with useEffect online without registration, duration hours minute second in high quality. This video was added by user Cosden Solutions 13 December 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 34,349 once and liked it 1.6 thousand people.