Stage 5 track

Track: State management ecosystems

Who it's for: you've finished Stage 4's capstone (context + reducer state, wired through a router) and want to know what a real app reaches for once useContext/useReducer stop being enough — as a frontend engineer who'll own a growing codebase's state layer.

Learn (in order): Zustand first, since its API is closest to the reducer/hook mental model Stage 2 Part 10 already built → Redux Toolkit second, as the more structured, convention-heavy alternative many teams standardize on, understood as "the same ideas, more ceremony" rather than a different paradigm → TanStack Query (or a similar server-state library) for caching, refetching, and request de-duplication, replacing the by-hand fetch + useEffect loading/error/empty-state code from Stage 3 Part 11 → a decision note on client state vs. server state as two different problems that don't belong in the same store, the question Stage 4, Part 16's decision-tree note raises but defers.

Capstone brief (to be written in full): rebuild the Stage 4 capstone's state layer on a real library, side by side with the hand-rolled version — the favorites/cart context+reducer moves to Zustand or Redux Toolkit, and the list/detail routes' fetch calls move to TanStack Query, with a short write-up comparing the two versions (lines of code, re-render behavior, what the library bought you and what it cost). Full user stories, milestones and an acceptance checklist will be added when this track's content wave begins.

What this brief does not claim: no package (zustand, @reduxjs/toolkit, @tanstack/react-query, or otherwise) was installed or run while writing this course (see ../TOOLING.md) — unlike Stages 1–4, where every snippet was run in a real Vite dev server or under Vitest and verified before publication. Treat every detail above as a design-time plan, not a tested lesson, until the content wave installs each library and verifies a working example the same way TOOLING.md verified the Vite scaffold.

Official docs to use when this wave starts: https://zustand-demo.pmnd.rs/ and https://github.com/pmndrs/zustand, https://redux-toolkit.js.org/, https://tanstack.com/query/latest

Search the guide