Skip to main content
Web Development

React Tutorial with Examples.

React tutorial with runnable examples: components, hooks, effects, the Rules of Hooks and the React Compiler, verified with real rendered and tested output.

Beginner

Start here — no prior experience needed

5 lessons

Intermediate

For developers with core concepts down

12 lessons
react intermediate
5 min read

See StrictMode's real double-invoked mount effect, then a cleanup function that actually runs on unmount and before every dependency change.

react intermediate
5 min read

Measure the extra render an effect adds when it only syncs derived state from props, then remove both the effect and the state entirely.

react intermediate
5 min read

Call a hook conditionally and see React's real hook-order error and stack trace, then fix it by keeping every hook call unconditional.

react intermediate
5 min read

Test a cart reducer as a plain function with no rendering, then share it through context and prove the provider guard throws without one.

react intermediate
5 min read

Extract reusable stateful logic into a custom hook, test it through a tiny host component, and give one an effect with real cleanup.

react intermediate
5 min read

Count real re-renders with and without memo, see why memo alone fails with an inline callback, and measure useMemo skipping an expensive call.

react intermediate
5 min read

Build a nested route tree with React Router 8's createMemoryRouter and RouterProvider, click a real Link in Vitest, and watch an unmatched URL render React Router's own 404 instead of a blank screen.

react intermediate
5 min read

Use createPortal to render a modal into document.body, prove in a real test that clicks still bubble through React's component tree instead of the DOM tree, and see the real error React throws when a portal reaches the server renderer.

react intermediate
5 min read

Write a class-based error boundary, watch it catch a real render TypeError and show its fallback UI, then see the one error it never reaches: a throw inside an onClick handler, which React routes around componentDidCatch entirely.

react intermediate
5 min read

Split a component out with React.lazy and watch Suspense show a fallback until the real import() resolves, then spike two things the docs gloss over: nested boundary reveal order, and what a key on Suspense actually resets.

react intermediate
5 min read

Read a promise directly inside a component with React's use() hook, then spike the two ways it goes wrong: a plain render() that never catches up, and a promise recreated every render that never settles at all.

react intermediate
5 min read

Add a Retry button to a React error boundary with the react-error-boundary library's FallbackComponent and onReset, then watch a rejected promise read with use() land in the same boundary as a real thrown error.

Advanced

Production-grade patterns for experienced engineers

5 lessons

Also part of React

Taught in other topics. Each link opens the lesson in its home topic.

5 lessons