Zero to Production React
React from first principles. You build a tiny React first, so the real one stops feeling like magic. Then hooks, concurrency, the Compiler, state management, Server Components, Next.js and what it takes to ship. Every chapter has code you can run and change right on the page.
How it works
- Each chapter starts with a problem, builds a solution from scratch, then shows the real API and how it maps back.
- Code blocks with a Run button are live. Edit them. Your changes and progress stay in this browser.
- Every chapter ends with interview questions and model answers. Rehearse collects all of them.
- Want a project on your machine? Starting a React app shows how to create and configure one.
Short on time? Chapters marked ★ are the interview-critical track; the toggle below shows only those.
Before React
The problem React exists to solve.Build a tiny React
Elements, diffing, keys, Fiber and hooks, from scratch.- 03Elements and JSX
JSX is a function call. Elements are plain objects.
- 04Rendering elements
Turn element objects into DOM, with components and props.
- 05The virtual DOM and diffinginterview-critical
Compare two trees and touch only what changed.
- 06Keysinterview-critical
How React knows which list item is which.
- 07Fiberinterview-critical
Rendering you can pause: the work loop and the two phases.
- 08Hooks from scratchinterview-critical
useState is an array slot on a fiber. That's why the rules exist.
- 09Effects from scratch
Run code after commit, clean it up, and map the toy to real React.
React fundamentals
The real APIs, mapped back to what you built.- 10Components and props
Composition, children, lists and why render must be pure.
- 11Events
Synthetic events, delegation at the root, passing handlers down.
- 12Stateinterview-critical
Snapshots, batching, immutability and where state should live.
- 13useReducer
Move update logic out of event handlers into one pure function.
- 14Refs
Values that persist without re-rendering, and handles to the DOM.
- 15Effectsinterview-critical
Synchronizing with the outside world, and when not to.
- 16Contextinterview-critical
Passing data deep without props, and what it costs.
- 17Custom hooks
Reusing stateful logic, plus useId and useSyncExternalStore.
- 18Component patterns
Compound components, render props, HOCs and headless UI.
- 19Forms
Controlled and uncontrolled inputs, and validation basics.
- 20Class components
Lifecycles, mapped to hooks. Still asked, still needed.
- 21Errors
Error boundaries, root error handlers and Owner Stacks.
- 22Portals and Profiler
Render outside the parent's DOM, and measure renders.
Concurrency and async UI
Scheduling, transitions, Actions and Suspense.- 23Rendering and schedulinginterview-critical
What triggers a render, and how React decides what to do first.
- 24Transitionsinterview-critical
Mark updates as non-urgent so the UI stays responsive.
- 25Actionsinterview-critical
Async transitions for forms: pending, optimistic, settled.
- 26Suspense and useinterview-critical
Waiting declaratively, and the fetching patterns behind it.
- 27Activity and View Transitions
Hide UI without losing state, and animate between states.
Performance and the Compiler
Measure, memoize, then let the Compiler do it.- 28Measure first
Profiler, Performance tracks and Core Web Vitals.
- 29Memoizationinterview-critical
memo, useMemo and useCallback, and the fixes that beat them.
- 30The React Compilerinterview-critical
Automatic memoization: how it works and whether to ship it.
- 31Big UI
Virtualization, code splitting and keeping the main thread free.
State management
Every kind of state and the tools for each.- 32Kinds of stateinterview-critical
Local, shared, server, URL, form, persisted and derived.
- 33Build a storeinterview-critical
useSyncExternalStore, selectors and tearing, from scratch.
- 34Redux Toolkit
Flux, one store, slices, middleware and time travel.
- 35Zustand
A store as a hook, with selectors and middleware.
- 36Atomic state
Jotai atoms, derived and async atoms.
- 37Reactive state and signals
MobX, Valtio, signals, and why React chose differently.
- 38State machines
Statecharts, XState, and impossible states made impossible.
- 39Server stateinterview-critical
TanStack Query, SWR and RTK Query: caching data you don't own.
- 40URL and form state
Search params as state, React Hook Form and Zod.
- 41Choosing state toolsinterview-critical
A decision framework and the trade-offs interviewers ask about.
Server rendering and Server Components
Moving work off the client.- 42Rendering strategiesinterview-critical
CSR, SSR, SSG, ISR, streaming, PPR and Server Components compared.
- 43SSR and hydrationinterview-critical
Render to HTML, stream it, and bring it to life.
- 44Server Componentsinterview-critical
Components that never ship to the browser, and the boundary.
- 45Server Functionsinterview-critical
Calling the server from a form, and securing the endpoint.
Next.js
The framework that packages all of it, and its caches.- 46The Next.js App Routerinterview-critical
Files become routes, layouts nest, and loading states stream.
- 47Data and mutations in Next.js
Fetching on the server, Server Actions, auth and proxy.ts.
- 48Caching in Next.jsinterview-critical
Cache Components, use cache, tags, and the older model.
- 49Rendering and deploying Next.js
Static shells, dynamic holes, runtimes and where it runs.
- 50Next.js versions and the Pages Router
What changed from 14 to 16, and the router you'll still meet.
- 51Caching across the stackinterview-critical
Every cache from component to CDN, and how to invalidate each.
Ecosystem and tooling
Starting, routing, typing, styling and testing.- 52Starting a React appinterview-critical
Frameworks, Vite, bundlers, and how to choose.
- 53Routing
React Router and TanStack Router outside Next.js.
- 54TypeScript with React
Typing props, events, refs, generics and state.
- 55Styling
CSS Modules, Tailwind, CSS-in-JS and component libraries.
- 56Testing
Testing Library, Vitest, MSW and Playwright.
- 57Accessibility
Semantic HTML, ARIA, focus and checking it.
- 58Tooling and DX
ESLint, formatters, Storybook and DevTools.