The React Show cover image

React FAQ

The React Show

00:00

React - Is There a Dependency Array?

Dependency aray was designed to be used for performance optimization. Instead of using it, use i statement at the very beginning of your used effect that checks if body should run. This could also be functions that get passed in, you know, things coming from ue state or wherever. It doesn't matter if it's a value that could theoretically change in your programme. I needs to be in there if it's referenced inside the used effect. And so this is why i always tell people, just don't use that dependency aray unless you actually have a performance bottle neck.

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app