Never fetch in useEffect! #reactjs #reactjsinterviewquestions #reactdeveloper #webdevelopment

preview_player
Показать описание
Why you shouldn't fetch data in useEffect in React and what to use instead.

📣 Follow Coding in Flow on social media:
Рекомендации по теме
Комментарии
Автор

Great video! Simple programming yet powerful. It is really insightful for someone like me who started using react query and swr directly without even being aware of race conditions. Thanks

prakashd
Автор

React query was just sitting in silence 😂

TechMagic
Автор

Just use isFetching useState for each fetch query

jaysoncainglet
Автор

Use debounce or don't use useEffect hook instead use rtk query or tanstack query

fazilabdulhameed
Автор

Nice! Thanks.

I have one question, how to connect the UI with some AI, I have to use the fetch from react-query also? My company is training an AI, should I use the fetch or should I use some SDK from Vercel or the Firebase Firebase-Genkit?

Thanks for all!

*PS: too green but is okay ♥

sobrehombre
Автор

A Websocket is used in useEffect tho right?

taherjerjissi
Автор

Why not abort the fetch in the cleanup function?

FirdausEdymainoe
Автор

I know this is unrelated but give the Quran a read

realhamza
Автор

When I see this modern 'programming' things it almost always looks like create a problem to solve a problem. Useless.

ivanpogildiakov
Автор

This is not a race condition, this is an ordering issue due to the absence synchronisation between requests and the rendering logic. “A race condition occurs when two or more threads can access shared data and they try to change it at the same time.” This is clearly not the case here and this is just unintentional misinformation due to lack of in-depth competence in concurrency.

markvido
Автор

Why I should never watch your video?
Rule number 1 and only 1: You tech guys are just showing some stupid techniques and rules to prove the programmer out there are techniques are useless.

omarfaruk
welcome to shbcf.ru