Content pfp
Content
@
0 reply
0 recast
2 reactions

Hector pfp
Hector
@noctis
Update: useEffect is a powerful tool so be careful when using it because it’s very easy to fuck up the performance of your app. Generally, you should not use useEffect when fetching data in a client-side app (not like I did until recently). Instead, you should use your meta-frameworks’ data fetching API (e.g Remix does that very well) or use React Query. Why? Because in dev mode, your custom useEffect will run twice and you’ll have to implement idempotent logic on top of the React useEffect boilerplate code. + caching + preventing network waterfall (fetching the data of all the children components not displayed) Put that in a reusable logic and you got yourself a less-good ReactQuery and we’re back full circle. I realized that recently and it feels weird to feel like everything you wrote before is shit lol.
0 reply
0 recast
5 reactions