Skip to content

Instantly share code, notes, and snippets.

UseEffect

useEffect() is an escape hatch for synchronizing with external systems (APIs, DOM manipulation, third-party libraries, browser APIs). It should not be used for orchestrating the state. React linters will warn against that.

useEffect() documentation | You Might Not Need an Effect

Dependency Patterns

With dependencies - runs after the initial render and when dependencies change: