On this page

What is React 19.2? Architecture, Compiler, and Server Components

12 min read TextCh. 1 — React Fundamentals

What is React?

React is a JavaScript library for building user interfaces. Created by Facebook (now Meta) in 2013, it has become the most widely used frontend technology in the world. Unlike full frameworks such as Angular or Vue, React focuses exclusively on the view layer — the part of your application that users see and interact with.

React's core philosophy revolves around three ideas:

  1. Declarative: You describe what the UI should look like for a given state, and React figures out how to update the DOM efficiently.
  2. Component-based: Interfaces are composed from small, reusable, isolated pieces called components.
  3. Learn once, write anywhere: The same React concepts power web apps, native mobile apps (React Native), VR experiences (React 360), and server-rendered pages (Next.js).

React 19.2: What's New

React 19.2 is a major milestone release. It ships with the React Compiler, Server Components as a stable API, improvements to the use() hook, and enhanced form actions. Understanding these features will help you write more efficient, maintainable code.

The React Compiler

The React Compiler (previously known as "React Forget") automatically optimizes your components by eliminating unnecessary re-renders — without you having to manually write useMemo, useCallback, or React.memo in most cases.

# Install the compiler as a Babel plugin
npm install babel-plugin-react-compiler

With the compiler enabled, the following code is automatically memoized:

// Before (manual optimization)
function UserCard({ user }: { user: User }) {
  const fullName = useMemo(() => `${user.first} ${user.last}`, [user.first, user.last]);
  return <div>{fullName}</div>;
}

// After React Compiler (automatic)
function UserCard({ user }: { user: User }) {
  const fullName = `${user.first} ${user.last}`; // Compiler handles memoization
  return <div>{fullName}</div>;
}

The compiler analyzes your code statically and inserts the equivalent of useMemo and useCallback where it determines they are beneficial. This dramatically reduces the amount of performance boilerplate you need to write.

Server Components

React Server Components (RSC) allow components to run on the server and stream their HTML output to the client. Server Components have direct access to databases, file systems, and environment variables — without any API layer in between.

// This component runs exclusively on the server
// Note: no 'use client' directive
async function ProductList() {
  // Direct database access — no useEffect, no loading state
  const products = await db.query('SELECT * FROM products LIMIT 20');

  return (
    <ul>
      {products.map((p) => (
        <li key={p.id}>{p.name} — ${p.price}</li>
      ))}
    </ul>
  );
}

Server Components have zero bundle size impact on the client, since they never ship to the browser.

The `use()` Hook

React 19 introduces a new built-in hook called use() that can unwrap Promises and Context values inside render:

import { use, Suspense } from 'react';

async function fetchUser(id: string): Promise<User> {
  const res = await fetch(`/api/users/${id}`);
  return res.json() as Promise<User>;
}

function UserProfile({ promise }: { promise: Promise<User> }) {
  // Suspends the component until the promise resolves
  const user = use(promise);
  return <h2>{user.name}</h2>;
}

function App() {
  const userPromise = fetchUser('42');
  return (
    <Suspense fallback={<p>Loading...</p>}>
      <UserProfile promise={userPromise} />
    </Suspense>
  );
}

Form Actions

React 19 brings first-class support for form actions — async functions you can attach directly to <form> elements:

async function createTask(formData: FormData) {
  'use server'; // Only in Server Components / Next.js App Router
  const title = formData.get('title') as string;
  await db.insert({ title });
}

function NewTaskForm() {
  return (
    <form action={createTask}>
      <input name="title" placeholder="Task title" />
      <button type="submit">Create</button>
    </form>
  );
}

How React Works: The Virtual DOM

React maintains a lightweight Virtual DOM — a JavaScript representation of the real DOM tree. When your application state changes, React:

  1. Re-renders the affected component in memory (producing a new Virtual DOM tree).
  2. Diffs the new tree against the previous one (the "reconciliation" phase).
  3. Computes the minimum set of changes needed to update the real DOM.
  4. Commits those changes to the browser.

This process is called reconciliation and it is what makes React fast. The real DOM is slow to manipulate; React batches and minimizes those manipulations.

In React 19, the reconciler has been upgraded with concurrent features enabled by default, allowing React to pause, interrupt, and resume rendering work. This means React can prioritize urgent updates (like user input) over less urgent ones (like data fetching).

Setting Up a React Project

The recommended way to start a new React 19 project is with Vite:

npm create vite@latest my-react-app -- --template react-ts
cd my-react-app
npm install
npm run dev

This gives you:

my-react-app/
  src/
    App.tsx         # Root component
    main.tsx        # Entry point (createRoot)
    index.css       # Global styles
  public/
    vite.svg        # Static assets
  index.html        # HTML template
  vite.config.ts    # Vite configuration
  tsconfig.json     # TypeScript configuration
  package.json      # Dependencies

Alternatively, if you are building a full-stack app with SSR, use Next.js 15 (which uses React 19 internally):

npx create-next-app@latest my-next-app --typescript --app

React vs. Other Solutions

Feature React 19 Angular 21 Vue 3
Type Library Framework Progressive Framework
Language JSX/TSX TypeScript SFC (.vue)
State Hooks + Context Signals Composition API
Routing React Router (external) Built-in Vue Router (external)
Data fetching TanStack Query / RSC HttpClient Pinia / Nuxt
Compiler React Compiler Template compiler Vapor (upcoming)

React intentionally keeps its surface area small. This gives you flexibility but also responsibility — you choose your own routing, state management, and data fetching libraries.

The React Ecosystem

Understanding the ecosystem around React is essential:

  • Vite — blazing-fast dev server and build tool
  • Next.js — full-stack React framework (SSR, RSC, App Router)
  • React Router v7 — client-side and server-side routing
  • TanStack Query — async state management and caching
  • Zustand — minimal global state management
  • Vitest + Testing Library — unit and integration testing

Throughout this course you will work with all of these tools in the context of a real-world TypeScript project.

Your First React Component

Every React application is a tree of components. The smallest unit is a function that accepts props and returns JSX:

interface WelcomeProps {
  username: string;
  isLoggedIn: boolean;
}

function Welcome({ username, isLoggedIn }: WelcomeProps) {
  if (!isLoggedIn) {
    return <p>Please sign in to continue.</p>;
  }

  return (
    <article>
      <h1>Welcome back, {username}!</h1>
      <p>You have new notifications.</p>
    </article>
  );
}

export default Welcome;

This single file demonstrates the fundamentals you will master throughout the course:

  • TypeScript interfaces for prop types
  • Destructuring props in the function signature
  • Conditional rendering with a plain if statement
  • JSX returning a semantic HTML structure
  • Expressions in JSX using curly braces {}

In the next lesson, you will dive deep into JSX syntax and learn how to build, compose, and organize components effectively.

Getting started quickly
Run `npm create vite@latest my-app -- --template react-ts` to scaffold a React 19 + TypeScript project in seconds. Vite's dev server starts in under 300ms and supports Hot Module Replacement out of the box.
React 19 requires Node.js 18+
Make sure you are using Node.js 18 or later. React 19.2 also works seamlessly with Bun and Deno. The new compiler requires a build step — it does not run in the browser directly.
StrictMode in development
React StrictMode intentionally renders components twice in development to help you find side effects. This is normal behavior — it does not affect production builds.
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';

// A simple functional component
function Greeting({ name }: { name: string }) {
  return (
    <div className="greeting">
      <h1>Hello, {name}!</h1>
      <p>Welcome to React 19.2</p>
    </div>
  );
}

// Root component
function App() {
  return (
    <main>
      <Greeting name="Developer" />
    </main>
  );
}

// Mount to the DOM
const root = createRoot(document.getElementById('root')!);
root.render(
  <StrictMode>
    <App />
  </StrictMode>
);