How to train your useReducer
summary
Compares a monolithic single-source approach to a distributed pattern by building a web configurator preview, shows the real bug where shared state causes unexpected cross-updates, and implements a concrete solution: a useReducer-based undoable enhancer wrapped via the decorator pattern, plus useCallback to fix double-invocation, TypeScript object reducers with generics and infer for safe actions, automated tests that pass, and a successful deploy; the claim is that useReducer plus small, targeted extensions replaces heavy global stores without breaking performance or team isolation.
AI-written summary · about
chapters (8)
- 0:00useReducer and state management
- 6:50Single source of truth limits
- 12:13useReducer as solution
- 16:11Fixing reducer duplication with useCallback
- 19:00Single responsibility in reducers
- 22:57Typed reducers with TypeScript
- 29:03Summary
- 32:14Q&A








