Week 2 — Managing State, Escape Hatches & Data
Days 1–2 build React state and Effects fluency; days 3–5 apply Redux Toolkit and TanStack Query to Nest-backed data — then ship a Todo mini-project (RTK + Query).
- 1. Reacting to input with stateOpen
Controlled inputs, change events, and form submission.
- 2. Choosing the state structureOpen
Avoiding redundancy, duplication, and deeply nested state.
- 3. Sharing state between componentsOpen
Single source of truth, controlled children, and callbacks.
- 4. Preserving and resetting stateOpen
Tree position, keys, remounting, and intentional resets.
- 5. Extracting state logic into a reducerOpen
useReducer, actions, and pure transition logic.
- 6. Passing data deeply with contextOpen
createContext, providers, consumers, and focused context values.
- 7. Scaling state with reducer and contextOpen
Provider composition, dispatch, and predictable actions.
- 8. Referencing values with refsOpen
useRef, mutable current, and state versus refs.
- 9. Manipulating the DOM with refsOpen
Ref assignment, focus management, and avoiding DOM conflicts.
- 10. Synchronizing with EffectsOpen
useEffect setup, dependencies, and cleanup.
- 11. You might not need an EffectOpen
Derived state, memoization only when needed, and event logic.
- 12. Lifecycle of reactive EffectsOpen
Setup, cleanup, dependency changes, and unmount.
- 13. Separating events from EffectsOpen
Causal reasoning, handlers, and reactive synchronization.
- 14. Removing Effect dependenciesOpen
Dependency honesty, stable values, and avoiding stale closures.
- 15. Reusing logic with custom HooksOpen
Hook composition, inputs, returned APIs, and rules of Hooks.
- 16. Caching calculations with useMemoOpen
Memoized derived values, dependency lists, and when a plain calculation during render is enough.
- 17. Caching functions with useCallbackOpen
Stable callbacks, memoized children, Effect dependencies, and avoiding needless wrapping.
- 18. Redux Toolkit — official tutorial pathOpen
This course lesson mirrors https://redux-toolkit.js.org/tutorials/overview and the Quick Start steps, then maps them onto this monorepo (Next + TypeScript + Nest).
- 19. RTK Essentials practice: client draftsOpen
This is our Redux Essentials-style lab: use RTK for a composer draft after Quick Start, then ship it in Week 4 Notes projects.
- 20. TanStack Query fundamentalsOpen
useQuery, useMutation, query keys, and invalidation.
- 21. Axios, Nest, and cookiesOpen
Axios instances, withCredentials, CORS, and 401 handling.
- 22. RTK Query vs TanStack Query (and when to use which)Open
Cover the RTK Query APIs from Getting Started, then the ownership rule for this course.
End-of-week mini-project · practice only
Todo app (RTK + Query)
Ship a Todo UI where unfinished draft text lives in Redux Toolkit and the todo list comes from TanStack Query (Nest or a stub).
Definition. A Todo mini-project is a client that separates unfinished composer state (RTK) from server-backed todo rows (TanStack Query + Axios cookies), matching this course’s ownership rule.
In simpler words. Type a draft in Redux. When you save, Query talks to Nest (or a mock). Never store the Nest list in Redux.
Deliverables
- configureStore + createSlice for draft text / selected todo id / filter chrome
- typed useAppDispatch / useAppSelector; Provider on the client tree
- useQuery list + useMutation create/toggle/delete with invalidateQueries on success
- Axios withCredentials for cookie JWT; no JWT in localStorage
- Honest loading / empty / error UI; disable submit while mutation pending
Acceptance checklist
- [ ] RTK owns draft + selection (not the Nest todos array)
- [ ] Query owns the list; onSuccess clears draft + invalidateQueries
- [ ] Redux DevTools shows draft updates as you type
- [ ] Cookie credentials path works (or documented stub)
- [ ] Empty ≠ loading; mutation errors visible on the form
- [ ] No JWT in localStorageTips
- If Nest Todos API is not ready, mock the HTTP contract first, then swap the queryFn.
- Reuse the same ownership table you will need for Week 4 Notes UI.
- Practice filterDraft vs appliedFilters if you add search — typing should not refetch every keystroke.