Level 4 · Full-Stack Application Development · Course 4.2 Frontend Architecture
Module 37: State Management
Goal: decide where each piece of state should live, share state across the app with Context, manage complex changes with reducers, and understand why data from a server is a different kind of state.
You'll need: your multi-page enquiries app from Module 36.
Lessons
- 1Local and global state15–25 minutes✓
- 2Context15–25 minutes✓
- 3Reducers15–25 minutes✓
- 4Server state is different15–25 minutes✓
- 5Choosing an approach15–25 minutes✓
🛠️Module practice: well-placed state
- Sign-in state in an
AuthProviderwith auseAuthhook. - Enquiries managed by a tested reducer.
- Filters in the URL; UI state local.
- A "State" section in the README explaining where each piece lives and why. Commit.
✅Module check
Explain in a few sentences, in your own words:
How do you decide where a piece of state should live in a React app?
Show a good answer
A good answer mentions: first, don't store what can be calculated; put shareable view settings in the URL; treat server data as server state managed by a fetching tool; keep UI state local and lift it only to the nearest common parent when shared; use focused Context (with a reducer for complex changes) for app-wide values like the signed-in user; and only bring in a store library for large apps with much shared client state.
📝Module quiz
10 questions · 10 marks each · 100 marks in all · pass mark 70% · retry as often as you like ·
