#react
- In JavaScript, each newly created object and function are considered distinct from all the others. So when there is a new render there is a new object and a new function that forces a re-synchronisation.
- Putting them in useEffect dependencies is inefficient. Ideally we should move the dependency inside the Effect, outside the component or extracting primitive values out of them.
---
Docs - https://react.dev/learn/removing-effect-dependencies