JavaScript library for building user interfaces through declarative, reusable components, with an ecosystem spanning from SPAs to full-stack applications with Server Components.
React is a JavaScript library for building user interfaces, created by Meta (then Facebook) and released as open source in 2013. Its core mental model: UI is a function of state. When state changes, React computes the minimal DOM difference and applies only the necessary updates.
Unlike frameworks such as Angular or Vue that offer a complete solution (routing, forms, HTTP), React focuses exclusively on the view layer. The ecosystem — Next.js, React Router, Zustand — complements what React does not include.
Everything in React is a component: a function that receives props and returns JSX. Since React 16.8 (2019), hooks replaced class components as the primary pattern:
import { useState } from "react";
function Counter({ initial = 0 }: { initial?: number }) {
const [count, setCount] = useState(initial);
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount((c) => c + 1)}>
Increment
</button>
</div>
);
}The fundamental hooks:
| Hook | Purpose | When to use |
|---|---|---|
useState | Local state | Values that change with user interaction |
useEffect | Side effects | Subscriptions, fetching, synchronization with external APIs |
useRef | Mutable reference | DOM access, values that persist without causing re-render |
useMemo | Value memoization | Expensive computations depending on few dependencies |
useCallback | Function memoization | Callbacks passed to optimized child components |
useContext | Shared context | Lightweight global state without prop drilling |
React 19 (December 2024) introduces significant changes in how data and forms are handled:
Actions and forms. useActionState replaces the manual useState + onSubmit + try/catch pattern for forms:
import { useActionState } from "react";
function LoginForm() {
const [state, submitAction, isPending] = useActionState(
async (_prev: { error?: string }, formData: FormData) => {
const res = await login(formData.get("email") as string);
if (!res.ok) return { error: "Invalid credentials" };
redirect("/dashboard");
return {};
},
{}
);
return (
<form action={submitAction}>
<input name="email" type="email" required />
<button disabled={isPending}>
{isPending ? "Submitting..." : "Sign in"}
</button>
{state.error && <p role="alert">{state.error}</p>}
</form>
);
}use() for promises and context. Allows reading promises directly in render, integrating with Suspense:
import { use, Suspense } from "react";
function UserProfile({ userPromise }: { userPromise: Promise<User> }) {
const user = use(userPromise);
return <h1>{user.name}</h1>;
}
// Usage with Suspense boundary
<Suspense fallback={<p>Loading...</p>}>
<UserProfile userPromise={fetchUser(id)} />
</Suspense>Other React 19 features:
| Feature | Description |
|---|---|
useOptimistic | Optimistic UI update before server confirmation |
ref as prop | forwardRef no longer needed — ref is a regular prop |
| Metadata in components | <title>, <meta>, <link> automatically hoisted to <head> |
| Stylesheets | Native <link rel="stylesheet"> support with deduplication |
| React Compiler | Automatic memoization — eliminates the need for manual useMemo/useCallback |
React re-renders a component every time its state or props change. In large applications, this can cause performance issues:
Practical rules:
React.memo only when the component frequently receives the same propsuseMemo/useCallback only when the cost of recomputing exceeds the cost of memoizingServer Components fundamentally change the architecture of React applications. The distinction:
| Aspect | Server Component | Client Component |
|---|---|---|
| Directive | None (default in App Router) | "use client" at the top of the file |
| Execution | Server only | Server (SSR) + client (hydration) |
| Data access | Direct (async/await, DB, filesystem) | Via API or server props |
| Interactivity | No — no state, no effects, no events | Yes — useState, useEffect, onClick |
| JS bundle | Not sent to the client | Included in the client bundle |
The rule: start with Server Components by default. Add "use client" only when interactivity, state, or browser APIs are needed.
| Category | Options | Notes |
|---|---|---|
| Full-stack framework | Next.js, Remix, TanStack Start | Next.js dominates with ~70% of new React projects |
| Global state | Zustand, Jotai, Redux Toolkit | Zustand is the most adopted for new projects |
| Styling | Tailwind CSS, CSS Modules, styled-components | Tailwind dominates in new projects |
| Forms | React Hook Form, Formik | React 19 Actions reduces the need for libraries |
| Testing | Vitest + Testing Library, Playwright | Testing Library promotes user-centric tests |
| Micro frontends | Module Federation, single-spa | For large teams with independent deploys |
React defined the component-based UI paradigm that dominates web development. With Server Components and React 19, it evolves from a client library to a full-stack model where server and client collaborate in the same component tree. For a senior engineer, understanding the boundary between Server and Client Components — and when to cross it — is the most important architectural decision in any modern React project.
use(), React Compiler, and new hooks.Typed superset of JavaScript adding optional static types, improving developer productivity, error detection, and code maintainability.
React paradigm where components execute on the server, sending only HTML to the client, reducing the JavaScript bundle and improving performance.
Patterns and libraries for managing frontend application state predictably, from local component state to shared global state.
React framework for full-stack web applications with Server Components, file-based routing, SSR/SSG, and built-in performance optimizations.
Architectural pattern extending microservices to the frontend, allowing independent teams to develop and deploy parts of a web application autonomously.
Native web standards for creating reusable, encapsulated components that work in any framework or without one.
Reusable template for creating micro frontends with React, TypeScript, Tailwind CSS, and Vite. Includes design system, testing, and CI/CD.
Micro frontend shell with a complete design system, 24 components, 666 tests, and WCAG AA compliance. Published on npm as @jonmatum/react-mfe-shell.
Interactive demo application for the React MFE Shell design system with PWA support, automated metrics, and component showcase.
Headless menu component for React with full accessibility, zero styles, and keyboard support. Published on npm.
Boilerplate for creating React libraries with TypeScript, Rollup, Jest, Tailwind CSS, Husky, and npm publishing.
Utility-first CSS framework enabling design building directly in markup using atomic classes, eliminating the need to write custom CSS.
Web applications using modern technologies to deliver native app-like experiences: installable, offline-capable, and with push notifications.
Collection of reusable components, patterns, and guidelines ensuring visual and interaction consistency in digital products at scale.
Practice of designing and developing digital products usable by all people, including those with visual, auditory, motor, or cognitive disabilities.