Loading
A React tool that runs code after a component appears or changes — like setting an alarm that goes off after you finish decorating a room.
A hook that runs side effects (data fetching, subscriptions, DOM mutations) after the browser paints. A dependency array controls when the effect re-runs, and returning a cleanup function prevents memory leaks.
useEffect schedules a passive effect that fires asynchronously after layout and paint, unlike useLayoutEffect which fires synchronously before paint. The dependency array is compared by Object.is; stale closures occur when dependencies are omitted. In Strict Mode (development), React intentionally double-invokes effects to surface cleanup bugs. Effects are the escape hatch from the pure render model for synchronizing with external systems.