Build modern UI with React 19 from Meta. Covers the whole of practical React development: Hooks fundamentals, the new Actions-based features, state management strategy, server state fetching, form validation, component design patterns, performance optimization, testing, and accessibility.
Intermediate
Updated Oct 1, 2026
~7 min read
14 sections
9 code examples
Web IDE lab included
⚛️
React Web IDE
Run code in the browser with nothing to install and learn through step-by-step examples.
Build modern UI with React 19 from Meta. Covers the whole of practical React development: Hooks fundamentals, the new Actions-based features, state management strategy, server state fetching, form validation, component design patterns, performance optimization, testing, and accessibility. Rather than listing concepts, this guide is organized so you can follow the content in the order you have to make decisions on a real project.
Key perspective
Frontend / app development
Do not stop at drawing the screen: look at state, data requests, routing, accessibility, and the unit of deployment together.
SPA web appsNext.js SSRReact Native (mobile)Electron (desktop)
Architecture diagrams
To make what you read stick, it helps to capture the flow as a picture first. The two diagrams below are reference maps you can keep coming back to while learning React.
Learning flow
Rendering diagram…
Architecture view
Rendering diagram…
Environment setup
When you first open React, the big picture matters more than individual commands. This section starts with the problems the concepts ahead were created to solve.
Choose Next.js if you need server rendering, routing, and SEO, and Vite for a light, fast, pure SPA.
BASH
# Next.js (recommended — includes SSR/Server Components)npx create-next-app@latest my-app --typescript --tailwind --app# Vite (SPA)npm create vite@latest my-app -- --template react-tscd my-app && npm install && npm run dev# To install just the React 19 corenpm install react@19 react-dom@19
Hooks fundamentals
Here you look at Hooks fundamentals alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
useState, useEffect, useCallback, useMemo, useRef — there are only two rules of Hooks. Call them only at the top level, and only inside components/custom hooks.
Here you look at New in React 19 alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
React 19 redefined how form submission and asynchronous work are handled around Actions. useActionState, useOptimistic, and use() are the core.
TSX
import { useActionState, useOptimistic, use } from 'react';// Manages the form submission state (pending/error) automaticallyfunction ProfileForm({ updateName }: { updateName: (prev: { error?: string }, formData: FormData) => Promise<{ error?: string }>;}) { const [state, formAction, isPending] = useActionState(updateName, {}); return ( <form action={formAction}> <input name="name" /> <button type="submit" disabled={isPending}>Save</button> {state.error && <p>{state.error}</p>} </form> );}// Update the UI optimistically before the server respondsfunction LikeButton({ likes, addLike }: { likes: number; addLike: () => Promise<void> }) { const [optimisticLikes, addOptimisticLike] = useOptimistic(likes, (state) => state + 1); return ( <button onClick={async () => { addOptimisticLike(); await addLike(); }}> Like {optimisticLikes} </button> );}// Read a Promise conditionally (works with Suspense)function Comments({ commentsPromise }: { commentsPromise: Promise<{ id: string; text: string }[]> }) { const comments = use(commentsPromise); return <ul>{comments.map(c => <li key={c.id}>{c.text}</li>)}</ul>;}
API
Purpose
useActionState
Manages the pending/error state of a form action automatically
useOptimistic
Updates the UI optimistically before the server responds
use()
Reads Promises and Context conditionally and integrates with Suspense automatically
React Compiler
An optimization that inserts memo/useMemo/useCallback automatically at build time
State management strategy
Here you look at State management strategy alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
The rule for deciding where state lives matters more than the shape of the component tree. The default is local state; lift it up when several components share it; use Context when the whole tree needs it; and manage app-wide client state with a dedicated library.
Values that rarely change, such as the theme or the signed-in user
App-wide client state
Zustand
UI state, form wizard steps, and so on (minimal boilerplate)
Large/complex domains
Redux Toolkit
Large teams that need action history tracking and time-travel debugging
Data from the server
TanStack Query / SWR
All API data that needs caching, revalidation, and optimistic updates
Server state & data fetching
Here you look at Server state & data fetching alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Data from the server has different problems from client state (caching, revalidation, deduplicating requests, optimistic updates), so it is safer to handle it with a dedicated library such as TanStack Query.
Here you look at Forms & validation alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
The React Hook Form + Zod combination is the standard for type-safe form validation. It also performs well, because each input re-renders only its own field rather than the whole form.
Here you look at Component design patterns alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
As components grow, pull logic out into custom hooks, isolate errors with an Error Boundary, and raise cohesion for sets of components that work together with a Compound Component.
TSX
import { Component, createContext, useContext, useState, type ReactNode } from 'react';// Error Boundary — isolates errors in a subtree so they do not take down the whole appclass ErrorBoundary extends Component<{ fallback: ReactNode; children: ReactNode }, { hasError: boolean }> { state = { hasError: false }; static getDerivedStateFromError() { return { hasError: true }; } componentDidCatch(error: unknown) { console.error(error); } render() { return this.state.hasError ? this.props.fallback : this.props.children; }}// Compound Component — shares internal state through Contextconst TabsContext = createContext<{ active: string; setActive: (id: string) => void } | null>(null);function Tabs({ defaultTab, children }: { defaultTab: string; children: ReactNode }) { const [active, setActive] = useState(defaultTab); return <TabsContext.Provider value={{ active, setActive }}>{children}</TabsContext.Provider>;}Tabs.Tab = function Tab({ id, children }: { id: string; children: ReactNode }) { const ctx = useContext(TabsContext)!; return <button onClick={() => ctx.setActive(id)} aria-selected={ctx.active === id}>{children}</button>;};
Performance optimization
Here you look at Performance optimization alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
From React 19 on, the React Compiler inserts memo/useMemo/useCallback automatically at build time. You still need to understand the principles to judge the cases the compiler misses.
Here you look at Testing alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
With Vitest + React Testing Library, test from the standpoint of "the screen the user sees". Verify behavior, not implementation details.
Counter.test.tsxTSX
import { render, screen, fireEvent } from '@testing-library/react';import { describe, it, expect } from 'vitest';import { Counter } from './Counter';describe('Counter', () => { it('increments the value when clicked', () => { render(<Counter />); const button = screen.getByRole('button', { name: /count/i }); fireEvent.click(button); expect(screen.getByText('1')).toBeInTheDocument(); });});
Accessibility
This section covers Accessibility from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.
Accessibility is not a feature to add later; simply using semantic HTML solves most of it.
React practical design
React practical design is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
In React, data flow design matters more than the component tree. Separate server state, client state, and form state, and keep component responsibilities small.
Decision point
Question to ask
Practical guideline
Boundaries
Which parts of the React code are most likely to change?
Separate input/output, configuration, external integrations, and the core rules.
State
Where is state created and where does it go away?
Make the owner and lifecycle of state visible in the code.
Failure
What does the caller receive on failure?
Decide the timeout, fallback, and error contract first.
React operating standards
This section covers React operating standards from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.
Rendering performance is affected more by unnecessary state placement and waterfalls than by memo. Design the Suspense/loading/error states.
React verification strategy
React verification strategy is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Tests based on user scenarios and accessibility tests are the core.
Quality axis
How to verify
Definition of done
Correctness
Automate the normal/failure cases.
The core scenarios pass reproducibly.
Regression prevention
When fixing a bug, leave the same case behind as a test.
The same failure is not deployed again.
Operability
Check the logs, metrics, and alerts.
There is a path for tracing the cause when a problem occurs.
React: frequently asked questions
When should I use useEffect and when should I not?
useEffect is for synchronizing with an external system after rendering: setting up subscriptions, timers, and browser API calls. Values that can be computed from other state, and logic that responds to an event, belong in the render calculation or an event handler, not in useEffect. That avoids unnecessary re-renders and bugs.
Do I have to use a state management library?
Not from the start. Begin with component state and props, plus Context where needed, and manage data fetched from the server with a data fetching library that handles caching and refetching. Introducing a state management library when client state shared across screens gets complicated is not too late.
Why do list items need a key?
React uses the key to work out which items were added, removed, or reordered compared with the previous render. Using the array index as the key can attach input values or state to the wrong item when the order changes, so use a unique ID from the data.
Next steps
This section covers Next steps from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.
🚀
Finished the component fundamentals?
Building production-grade React applications — server rendering, the App Router, server actions, ISR, and more — continues in the Next.js guide. If you need a large, type-safe codebase, see the TypeScript guide, and if you want to firm up the language basics, the JavaScript guide.