React — Revision Notes
Condensed summary consolidating Overview, Intermediate, Advanced, and Troubleshooting — use this as a fast pre-interview or pre-project refresher, not as a first read.
Core model (Overview)
Hooks fundamentals
useState: local memory across renders; setter call schedules a re-render, doesn't update the current render's value in placeuseEffect: side effects after render; dependency array controls re-run timing ([] once, [deps] on change, omitted every render); return a cleanup function for anything that needs cancellationIntermediate patterns
useContext): for values genuinely needed at many depths (theme, current user) — not a default replacement for prop passing between nearby componentsuseRef: mutable value across renders that does NOT trigger a re-render when changed; DOM access, or storage for things like interval IDsuse, calling other hooks — the mechanism for reusing stateful logicAdvanced
keyuseMemo/useCallback: memoize a computed value / a function reference respectively — worth it for genuinely expensive computation or to stabilize a reference for a memoized child; not a default habit, profile firstgetDerivedStateFromError + componentDidCatch) — no hook equivalent existsReact.lazy: code-splitting, load a chunk only when needed; fallback shown while loadingTroubleshooting — recurring bug patterns
AbortController in the cleanup functionsetX(prev => ...)) or add the correct dependencyarray.push() then setting with the same reference — React compares by reference, sees no change, skips the re-render; always create a new referenceVersioning Note
Durable, stable-since-hooks-were-introduced concepts: the component model, props/state, the Virtual DOM/reconciliation idea, and the core hooks (useState, useEffect, useContext, useRef) plus the Rules of Hooks — safe to treat as durable fact.
(needs verification — recheck against current source) for anything version-specific or actively evolving: the newer use hook, the React Compiler (automatic memoization, reducing the need for manual useMemo/useCallback in some cases), and React Server Components specifics — Server Components in particular are more of a Next.js-era/meta-framework concern in practice, and are covered lightly here on purpose; this platform's future Next.js technology is where they're covered in depth.

