Back to library

⚛️React Hooks Mental Model

Build one mental model for React hooks — each render is a snapshot, and every hook either reads from it or syncs the outside world to it — then use that model to fix stale closures, tame dependency arrays, and extract clean custom hooks from a real component.

Applied14 drops~2-week path · 5–8 min/daytechnology

Phase 1Why Hooks Exist and the Rules Behind Them

See why hooks exist and the rules that keep them sane

4 drops
  1. Every render is its own frozen snapshot

    6 min

    Every render is its own frozen snapshot

  2. Hooks are a list indexed by call order

    6 min

    Hooks are a list indexed by call order

  3. useState is two things — a value and a setter pair

    6 min

    useState is two things — a value and a setter pair

  4. useEffect syncs the outside world to your snapshot

    7 min

    useEffect syncs the outside world to your snapshot

Phase 2Stale Closures and Dependency Array Traps

Fix stale closures and dependency array traps with confidence

5 drops
  1. Your callback is reading yesterday's state

    7 min

    Your callback is reading yesterday's state

  2. The dependency array isn't a re-run list — it's a promise

    7 min

    The dependency array isn't a re-run list — it's a promise

  3. Updater functions escape the stale closure trap

    6 min

    Updater functions escape the stale closure trap

  4. useRef is a mutable box that doesn't trigger renders

    7 min

    useRef is a mutable box that doesn't trigger renders

  5. Effects run after paint; layout effects run before

    6 min

    Effects run after paint; layout effects run before

Phase 3Choosing Between useState, useReducer, useMemo, useCallback

Choose between useState, useReducer, useMemo, and useCallback

4 drops
  1. The form with five fields and growing

    6 min

    The form with five fields and growing

  2. The list that re-renders the world

    7 min

    The list that re-renders the world

  3. The hook that fetches — and refetches forever

    7 min

    The hook that fetches — and refetches forever

  4. The hook that feels like it wants to be custom

    6 min

    The hook that feels like it wants to be custom

Phase 4Extract a Custom Hook From Real Code

Extract a clean custom hook from a tangled real component

1 drop
  1. Extract a reusable custom hook from a real component

    8 min

    Extract a reusable custom hook from a real component

Frequently asked questions

Why do React hooks have to be called in the same order every render?
This is covered in the “React Hooks Mental Model” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
What exactly is a stale closure in a React component?
This is covered in the “React Hooks Mental Model” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
When should I use useReducer instead of useState?
This is covered in the “React Hooks Mental Model” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Do I really need useCallback and useMemo everywhere?
This is covered in the “React Hooks Mental Model” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
How do I know when to extract a custom hook?
This is covered in the “React Hooks Mental Model” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.