Stage 2

Stage 2: Intermediate

✅ Complete. Every part below has its full lesson (README.md), examples/, exercises.md and solutions/, and the examples and solutions were actually run — see each part's README for real, captured output and ../TOOLING.md for the verified toolchain.

Goal: Master the core hooks beyond useState — effects, custom hooks, refs, context, and reducers — so you can manage real, non-trivial component state without reaching for a library. Time: ~21 h of lessons + ~6 h project (~27 h total) at 1–1.5 hours a day · Level: comfortable building static, interactive UIs (Stage 1 done)

Legacy reading note (not a lesson): this stage opens with a short, one-page note mapping old class-component lifecycle methods to hooks (componentDidMount/componentDidUpdate/componentWillUnmount → useEffect; this.state/this.setState → useState). This is so you can read older blog posts, Stack Overflow answers, and legacy codebases without being lost — no lesson time is spent writing class components.


Parts in this stage

Part Topic Learning outcomes Time
6 useEffect and side effects Explain what counts as a side effect; use the dependency array correctly; write cleanup functions; avoid the infinite-loop and stale-closure traps ~5 h
7 Custom hooks Recognize duplicated stateful logic across components; extract it into a useXyz hook; follow the "hooks call hooks, components call hooks" rule ~4 h
8 useRef and the DOM Use useRef for a DOM handle (focus, scroll) vs as a mutable instance variable that doesn't trigger a render; know when not to reach for the DOM directly ~3 h
9 useContext Recognize prop-drilling pain; create and provide a context; consume it with useContext; know context's performance ceiling (and that it is not a general state-management replacement) ~4 h
10 useReducer Model a UI's state transitions as actions and a reducer function; decide when a reducer is clearer than several useState calls; combine useReducer with useContext ~5 h

Prerequisites for this stage

Stage 2 project {#stage-2-project}

Expense Tracker UI — deliberately the same idea as the Python course's CLI Expense tracker, rebuilt as an interactive, client-side UI:

Acceptance sketch (the project README has the final checklist):

Next

Stage 3: Advanced

Search the guide