Description
An AI agent has one reflex when you ask it for shared state: reach for a global store and put everything in it. It will drop your server data (which is a cache with an owner somewhere else) into that store and hand-sync it with effects, so the screen shows a note that was deleted on the server ten minutes ago. It will write a Context whose value is a fresh object every render, so one keystroke re-renders a screen nobody touched. It will store a total you should have computed, so the number drifts the moment a line changes. It will write a selector that returns a new array every call, so the component re-renders forever. It will denormalize the same category into forty rows and let them fall out of sync. Every one of these renders, type-checks, and demos clean, so it looks done. The store is where an app’s real complexity hides, and the agent optimizes for code that looks reasonable, not state that stays correct under real data. What you lack is the reviewer’s model: which state is server cache and which is client truth, which value should be stored and which computed, and how much machinery a piece of state actually earns, so you can read the diff and know whether to ship it.
This book trains you to be the reviewer of vibe-coded state, not to memorize Redux or Zustand. The premise is different from every other state-management book: the agent writes the reducers and the providers and the selectors, and your edge is knowing whether the state underneath them is modeled right, a judgment no type checker makes. You will learn the one distinction most state bugs come down to, server cache versus client state, and why hand-syncing the first into the second is the mistake that ships stale data to users. You will learn why Context re-renders every consumer when its value’s reference moves, when a piece of state has earned an external store and when Context or a lifted `useState` was always enough, how Redux Toolkit and Zustand actually model a store and where each fits, why a selector that returns a new reference re-renders forever, why derived data belongs in the render and not in the store, how normalizing data keeps two screens from disagreeing, and why a form is the last thing that should live in a global store. You learn all of it the way a reviewer needs it: by reading the store code an agent would generate against one running project, a budgeting client called Ledger, and deciding what is correct, what is plausible-but-expensive, and what to send back. There is almost no library setup here and a great deal about where state belongs, what it should hold, and the specific ways an agent’s state management goes quietly wrong. For engineers who are going to vibe-code the store either way and want to be the one who catches the stale cache before the user does.
Who this was written for
This book is for: engineers who have decided to let an AI agent write their React (vibe-coding) and now own the part the agent cannot, which is judging whether the app’s state is modeled correctly, and who would rather learn to read a diff of state code than memorize five state libraries they will configure by hand exactly once.
What you’ll walk away with
- Chapter 1: How I learned state was the part the agent couldn’t get right
- Chapter 2: Does this really need to be global, or am I about to regret it?
- Chapter 3: Why the app crawls when state lives too far up
- Chapter 4: Why one keystroke re-renders a screen nobody touched
- Chapter 5: When do I actually need a store and not just Context?
- Chapter 6: Is Redux overkill, or the thing that makes state boring again?
- Chapter 7: The store that fits in one file, and when that’s all you need
- Chapter 8: Why my component re-renders when nothing it reads changed
- Chapter 9: The server data you keep copying into state was never yours
- Chapter 10: Why the category you renamed still shows the old name
- Chapter 11: The total that goes wrong the moment you store it
- Chapter 12: Why the form does not belong in your global store
- Chapter 13: How I decide, in one minute, where a piece of state goes


