Learn React

Component-based JavaScript library for building user interfaces

34 lessons · 8 hours · 4 levels · covers React 19.2

React is a JavaScript library for building user interfaces from reusable components that describe what the screen should show for the current data. It powers web apps through react-dom and frameworks like Next.js and React Router, and native apps through React Native. React 19 adds Actions, the use() API, Server Components and the React Compiler.

Before you start

React builds on these; the tree links to the exact lessons you need.

How deep do you want to go?

1. EssentialsRead and write simple code, do the everyday basics11 lessons · 2 hours in total
2. PracticalUse it productively at work, with the usual idioms22 lessons · 4 hours in total
3. AdvancedThe less common features, performance and trade-offs29 lessons · 6 hours in total
4. ExpertInternals and the edge cases experts know34 lessons · 8 hours in total

The React tree

ReactWhat React isWhat React isCreating a project with ViteCreating a projectwith ViteYour first componentsYour firstcomponentsJSXJSXPropsPropsConditional renderingConditional renderingRendering lists and keysRendering lists andkeysResponding to eventsResponding to eventsState with useStateState with useStateUpdating objects and arraysUpdating objects andarraysForms and controlled inputsForms and controlledinputsThinking in React and lifting stateThinking in React andlifting statePure components and Strict ModePure componentsand Strict ModeuseEffect and synchronizinguseEffect andsynchronizingRefs, DOM access and portalsRefs, DOM accessand portalsCustom HooksCustom HooksContextContextReducers with useReducerReducers withuseReducerData fetching patternsData fetchingpatternsStyling approachesStyling approachesRouting with React RouterRouting with ReactRouterTesting componentsTesting componentsModules: import and exportModules: import andexportFunctionsFunctionsDestructuring, spread and restDestructuring,spread and restArray methods: map, filter, reduceArray methods: map,filter, reduceHandling eventsHandling eventsObjectsObjectsasync and awaitasync and awaitClosuresClosures
Essentials and Practical shown (22 of 34 lessons); the full list is below. Click a lesson to read it.

All 34 lessons, in order

Getting started

  1. What React is · Essentials · 6 min

    React is a library for building user interfaces out of components that describe what the screen should look like for given data.

  2. Creating a project with Vite · Essentials · 10 min

    Scaffold a React app with Vite, understand its files, and run the dev server with fast refresh.

Components and JSX

  1. Your first components · Essentials · 10 min

    Define components as capitalised functions that return JSX, nest them, and export them from modules.

  2. JSX · Essentials · 10 min

    Write markup in JavaScript with JSX: curly braces for expressions, camelCase attributes, className and style objects.

  3. Props · Essentials · 12 min

    Pass data to components through props, destructure them, set defaults, and pass JSX as children.

  4. Conditional rendering · Essentials · 8 min

    Show different UI depending on conditions with if/return, the ternary operator and &&.

  5. Rendering lists and keys · Essentials · 12 min

    Turn arrays into elements with map and filter, and give each item a stable key so React can track it.

State and interactivity

  1. Responding to events · Essentials · 10 min

    Attach event handlers with onClick and friends, pass handlers as props, and use the event object.

  2. State with useState · Essentials · 15 min

    Give a component memory with useState, understand that state is a snapshot, and use updater functions.

  3. Updating objects and arrays · Essentials · 12 min

    Treat objects and arrays in state as immutable: copy them with spread, map and filter instead of mutating.

  4. Forms and controlled inputs · Essentials · 12 min

    Build forms with controlled inputs bound to state, or uncontrolled inputs read on submit with FormData.

  5. Thinking in React and lifting state · Practical · 15 min

    Break a UI into components, find the minimal state, decide which component owns it, and lift state up to share it.

  6. Reducers with useReducer · Practical · 12 min

    Consolidate complex state updates into a reducer function that handles dispatched actions.

Effects, refs and Hooks

  1. Pure components and Strict Mode · Practical · 10 min

    Keep rendering pure (same inputs, same JSX, no side effects) and use Strict Mode to catch impurity during development.

  2. useEffect and synchronizing · Practical · 18 min

    Use effects to synchronize a component with external systems, with correct dependencies and cleanup, and know when not to use one.

  3. Refs, DOM access and portals · Practical · 14 min

    Keep mutable values that don't trigger renders with useRef, reach DOM nodes through ref, and render elsewhere with createPortal.

  4. Custom Hooks · Practical · 12 min

    Extract reusable stateful logic into your own use-prefixed functions that call other Hooks.

Building real apps

  1. Context · Practical · 12 min

    Pass data deeply without prop drilling using createContext, a provider, and useContext or use.

  2. Data fetching patterns · Practical · 16 min

    Fetch data in effects without race conditions, and know when to use a data library, a framework loader or use() instead.

  3. Styling approaches · Practical · 10 min

    Choose between plain CSS, CSS Modules, utility CSS like Tailwind and CSS-in-JS, and use className and style correctly.

  4. Routing with React Router · Practical · 14 min

    Map URLs to components with React Router: routes, nested layouts, links, URL params and navigation.

  5. Testing components · Practical · 15 min

    Test components the way users use them with Vitest and React Testing Library: render, query by role, interact, assert.

Rendering and performance

  1. Rendering and reconciliation · Advanced · 15 min

    Understand trigger, render and commit, how React diffs trees by type and key, and when state is preserved or reset.

  2. Memoization and the React Compiler · Advanced · 16 min

    Skip unnecessary work with memo, useMemo and useCallback, and let the React Compiler apply memoization automatically.

  3. Profiling performance · Advanced · 12 min

    Find slow renders with the React DevTools Profiler, the Profiler component and browser performance tools, then fix the real cause.

Suspense, transitions and Actions

  1. Suspense, lazy and use() · Advanced · 16 min

    Declare loading states with Suspense boundaries, code-split with lazy, and read promises during render with use().

  2. Transitions and useDeferredValue · Advanced · 15 min

    Mark updates as non-urgent with useTransition and startTransition, and defer slow parts of the UI with useDeferredValue.

  3. Error boundaries · Advanced · 12 min

    Catch rendering errors in a subtree and show fallback UI with an error boundary, and report errors from the root.

  4. Actions and form hooks · Advanced · 18 min

    Handle async mutations with Actions: form action props, useActionState, useFormStatus and useOptimistic.

Under the hood

  1. Fiber, lanes and concurrent rendering · Expert · 20 min

    How React's Fiber architecture splits rendering into interruptible units of work, prioritises updates with lanes, and commits atomically.

  2. External stores with useSyncExternalStore · Expert · 15 min

    Subscribe to state that lives outside React safely, without tearing, using useSyncExternalStore.

Server rendering

  1. Server Components · Expert · 20 min

    Render components on the server or at build time with React Server Components, and mark interactive parts with 'use client'.

  2. Server Functions and server actions · Expert · 16 min

    Call server code from the client with 'use server' functions, use them as form actions, and secure them like public endpoints.

  3. Hydration and streaming SSR · Expert · 18 min

    Render to HTML on the server, stream it with Suspense, and hydrate it on the client without mismatches.