Skip to content

Lesson 37 of 37React at scale

Wrap-Up: React

Tie the React course together: one realistic feature built from first component to tested, debugged production code, a mixed review, and where to go next.

14 min read0/6 questions

You started this course with The React Story and the idea that UI is a function of state. Since then you have written components, given them memory, synced them with the outside world, learned how React renders, picked up the React 19 tools, and set up, typed, styled, tested and debugged real apps. On the job these never arrive one lesson at a time. This lesson lines them up once more and then uses them together on one feature.

The path you took

The React course, unit by unit
  1. Unit 1

    Thinking in React

    JSX, components, props, lists, conditions and events let you describe any screen as a tree of small functions.

  2. Unit 2

    State

    useState, snapshots, lifting state, forms, reducers and context gave those components memory and a way to share it.

  3. Unit 3

    Effects and beyond

    Effects, refs, custom hooks, data fetching, rendering and performance connected components to the world and showed you what React does with them.

  4. Unit 4

    Modern React

    Transitions, Suspense, Actions, error boundaries, Activity and view transitions made slow data and failures feel smooth.

  5. Unit 5

    Real projects

    Vite setup, TypeScript, styling and testing turned examples into a project a team can work on.

  6. Unit 6

    React at scale

    Stores, server state, big forms, routing, accessibility, i18n, component APIs and debugging prepared you for a large codebase.

How it fits together

The ticket: "Customers need an Orders page. They can search and filter their past orders, open one to see details, and cancel an order that has not shipped yet. It must work with a keyboard and a screen reader, and support says the current version sometimes shows the wrong order after a search." Here is how the course shows up, in the order you would really work.

Shaping the screen. You sketch the tree first: OrdersPage holds a SearchBar, a StatusFilter and an OrderList of OrderRow items, with an OrderDetails panel. Each is a function of its props, as in Components and Props. The list uses map with order.id as the key, never the index, which Lists and Keys showed is exactly how a row ends up showing the wrong order's state. The list has four states, loading, empty, error and success, modelled as one union from Conditional Rendering, and you avoid orders.length && ... so a stray 0 never appears.

Deciding where state lives. The search text and status filter belong in the URL, so a link to "cancelled orders matching 'shoes'" can be shared. That is the classification from State Management at Scale, and Client-Side Routing shows how to read and write search params. The filtered list is derived during render, not copied into state and synced with an effect, as Lifting State Up and the "You might not need an effect" section of useEffect taught. The only local state is which order is open.

Loading the data. The orders are server state, so they go through TanStack Query with a key like ["orders", { q, status }], as Server State with TanStack Query taught. That one choice fixes support's bug. The old code fetched in an effect without the ignore flag, so a slow response for an earlier search could land after a newer one, the race condition from useEffect and Data Fetching. The query library keys each response to its inputs, so a stale answer cannot overwrite a fresh one.

Keeping typing smooth. Filtering a long list on every keystroke made the input lag. Before reaching for memo, you profile it as Performance insists, and find the list re-rendering in full on each key. Wrapping the URL update in a transition, or reading the query through useDeferredValue, keeps the input urgent and the list non-urgent, as Transitions, Suspense and Deferred Values explained. Long histories get virtualization.

Cancelling an order. The cancel button is a form with an Action. useActionState tracks the result and errors, useFormStatus disables the button while pending, and useOptimistic marks the row as cancelled immediately and rolls back if the server refuses, all from Actions and Optimistic UI. A confirm step uses a native dialog with focus moved into it and back to the button afterwards, following Accessible Components: Portals, Focus and ARIA. The status labels go through the message catalog and dates through Intl, from Internationalization in React, because the app ships in three languages.

Containing failures. The details panel sits inside its own error boundary with a retry button, so a bad order record breaks one panel and not the page, as Error Boundaries and Resilient UI described.

Typing and testing it. Props, the order union and the action state are typed with React with TypeScript, so passing a "shipped" order to the cancel button is a compile error. Tests use Vitest and Testing Library, query by role and label, and mock the API with MSW, as Testing React taught. One test types a search, delays the first response and checks the right orders appear, which pins the race bug so it cannot come back. A Playwright test covers the cancel flow end to end.

Shipping and watching. After release, the error tracker shows a hydration warning for some users. You follow the routine from Debugging React Apps: decode the error, reproduce it with the release tag and breadcrumbs, find the component in DevTools, and fix a date formatted with the browser's time zone on one side and the server's on the other.

No lesson worked alone. Good keys and derived state removed a class of bugs before testing, the query cache removed the race, and the tests made the fix permanent. That is React at work.

Check yourself

Predict the outputJavaScript

count is 0 and the user clicks once. What does the button show after the re-render?

function handleClick() {
setCount(count + 1);
setCount(count + 1);
setCount(count + 1);
}
Need a nudge? Hints walk you through it.
Predict the outputJavaScript

orders is an empty array. What does this render on the page?

<div>
{orders.length && <OrderList orders={orders} />}
</div>
Need a nudge? Hints walk you through it.
Quick check
A component stores filteredOrders in state and updates it in a useEffect whenever orders or query change. What is the best review comment?
Need a nudge? A hint rules out a wrong answer.
Match the pairs0/6 matched

Match each problem to the tool you would reach for first.

Choose an item, then its match on the other side.
Put it in order6 steps

Put the phases of a React update in order.

  1. Tap the steps below in the right order.
Need a nudge? A hint shows where it starts.
Quick check
A test finds the cancel button with container.querySelector('.btn-danger'). Why should you change it?
Need a nudge? A hint rules out a wrong answer.

What you can do now

  • Break a design into components with clear props, good keys and the right loading, empty and error states.
  • Decide where each piece of state belongs: local, lifted, context, a store, the URL or a server cache.
  • Use effects only for syncing with the outside world, and avoid the races and loops that catch beginners.
  • Use React 19 Actions, useOptimistic, transitions and Suspense for mutations and slow data.
  • Set up a typed Vite project, write behaviour tests with Testing Library and MSW, and add end-to-end coverage.
  • Build accessible dialogs and forms, and debug a production bug from an error report to a regression test.

That is a solid mid-level grasp of React. What you do not have yet is years of a large codebase, server rendering at depth or a team's design system to maintain. That comes from the next courses and from real work.

Mistakes that still catch people

  • Syncing derived state with effects. It adds a render and drifts out of date. Revisit Lifting State Up and useEffect.
  • Index keys on lists that change. State sticks to the wrong row after a sort or delete. Revisit Lists and Keys.
  • Stale closures in timers and handlers. A callback keeps reading old state. Revisit State as a Snapshot and Debugging React Apps.
  • Memoizing before measuring. memo and useCallback everywhere add noise and rarely fix the real cause. Revisit Performance and How Rendering Works.
  • Server data in a client store. Copying fetched data into Zustand or context means writing your own cache, badly. Revisit Server State with TanStack Query and State Management at Scale.
  • Custom widgets without keyboard support. A clickable div locks out keyboard and screen reader users. Revisit Accessible Components: Portals, Focus and ARIA.

Where to go next

The natural next course is Next.js: it adds routing, server rendering, Server Components, Server Actions and deployment on top of everything here, and it is the most common way React is used in job postings. After that, Design & Architecture has a lesson on structuring React apps for large teams. If interviews are close, Interview Prep includes React questions, and Algorithms & Patterns covers the coding rounds.

Real practice matters as much as the next course:

  • Build and ship a small app. Something with search, a form, a mutation and real data, tested and deployed, that you can show and explain. Project: A Gym Workout Log is a starting point: finish its stretch goals and deploy it.
  • Build in the Project Lab. Its React builds take you from a Vite setup to a full-stack app with a FastAPI backend, step by step on your own machine.
  • Contribute to an open-source React library. A headless UI kit or a hooks library teaches API design and accessibility fast.
  • Read the official docs. react.dev, especially "You Might Not Need an Effect" and the reference pages, will answer questions for years.
Key terms
snapshot
The fixed state values a single render and its event handlers see; a setter asks for a new render rather than changing them.
derived state
Data calculated from existing props or state during render instead of stored and synced separately.
server state
Data owned by a backend that the client caches, refetches and invalidates, unlike UI state the client owns.
reconciliation
React's comparison of the new element tree with the previous one to work out the smallest set of DOM changes.
transition
An update marked as non-urgent so React can keep urgent work, like typing, responsive while it renders.
optimistic update
Showing the expected result of a mutation immediately and rolling it back if the server rejects it.
error boundary
A component that catches render errors in its subtree and shows fallback UI instead of unmounting the app.