Effect Dependency Arrays
The dependency array lists every reactive value the effect reads; React re-runs the effect only when Object.is comparison finds a changed entry. Omitting a dependency traps a stale closure over old props/state, while unstable object or function identities cause the effect to fire every render.
This Concept is waiting for its first lesson!
The dependency array lists every reactive value the effect reads; React re-runs the effect only when Object.is comparison finds a changed entry. Omitting a dependency traps a stale closure over old props/state, while unstable object or function identities cause the effect to fire every render.
Are you a teacher? Sign in to start contributing.
Sign In