The problem with useEffect

Опубликовано: 13 Декабрь 2023
на канале: 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!


Смотрите видео The problem with useEffect онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Cosden Solutions 13 Декабрь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 34,349 раз и оно понравилось 1.6 тысяч людям.