How Does React Work? Components, Virtual DOM & Rendering Explained (2026)

How React works - diagram showing components, virtual DOM, and rendering

React works by breaking your UI into reusable components, tracking state changes, and efficiently updating only the parts of the DOM that need to change using a virtual DOM. Instead of reloading an entire page when data changes, React calculates the minimum number of updates needed and applies them — making applications fast and responsive.

This guide explains the core mechanics of React: components, JSX, the virtual DOM, state and props, hooks, and the rendering lifecycle. Whether you’re evaluating React for a project or learning it for the first time, you’ll understand exactly how it works under the hood.

Want to build React UIs without writing code from scratch? UXPin Merge lets you drag and drop real React components from production libraries like MUI, Ant Design, and Bootstrap — then export clean JSX. Try it free.

What Is React?

React (also called React.js or ReactJS) is an open-source JavaScript library for building user interfaces. Created by Meta (Facebook) in 2013, it is now maintained by Meta engineers and a large open-source community.

React is used by companies of all sizes to build web applications like PayPal and Netflix, mobile apps (via React Native), and complex enterprise tools. It’s the most popular frontend library, with millions of weekly npm downloads.

React is not a full framework like Angular. It focuses on the view layer only, giving you the freedom to choose your own routing, state management, and backend solutions.

Core Concepts: How React Works Step by Step

1. Components — The Building Blocks

Everything in a React application is a component. A component is a self-contained piece of UI that accepts inputs (called props) and returns JSX describing what should appear on screen.

There are two types of components:

  • Functional components (modern standard) — JavaScript functions that return JSX. They use hooks for state and side effects.
  • Class components (legacy) — ES6 classes that extend React.Component. Still supported but rarely used in new code.
function WelcomeMessage({ name }) {
  return <h1>Hello, {name}!</h1>;
}

Components can be nested, composed, and reused throughout your application. A page might consist of a Header, Sidebar, MainContent, and Footer component, each managing its own logic and rendering.

2. JSX — Writing UI in JavaScript

JSX (JavaScript XML) is a syntax extension that lets you write HTML-like markup directly in JavaScript. It makes component templates readable and expressive:

function App() {
  return (
    <div>
      <Header />
      <MainContent />
      <Footer />
    </div>
  );
}

JSX is not HTML. It gets compiled to React.createElement() calls by your build tool (Vite, webpack). This compilation step is why you need Node.js in your development environment.

3. Props and State — Managing Data

React components use two types of data:

  • Props (properties) — read-only data passed from parent to child components. Think of them as function arguments. A parent might pass title="Dashboard" to a PageHeader component.
  • State — mutable data owned by a component. When state changes, React re-renders that component and its children. State is managed with the useState hook in functional components.
function Counter() {
  const [count, setCount] = useState(0);
  return (
    <button onClick={() => setCount(count + 1)}>
      Clicked {count} times
    </button>
  );
}

Data flows one way in React: from parent to child through props. This unidirectional data flow makes applications predictable and easier to debug.

4. Virtual DOM — Efficient Rendering

The virtual DOM is React’s performance secret. Here’s how it works:

  1. Render — when state or props change, React creates a new virtual DOM tree (a lightweight JavaScript object representing the UI).
  2. Diff — React compares the new virtual DOM with the previous one using a diffing algorithm (called “reconciliation”).
  3. Patch — only the elements that actually changed are updated in the real DOM.

This process is fast because manipulating JavaScript objects in memory is much cheaper than touching the real DOM. Instead of rebuilding the entire page, React surgically updates only what changed.

5. Hooks — Adding Logic to Functional Components

Hooks (introduced in React 16.8) let functional components manage state and side effects without class syntax. The most commonly used hooks are:

  • useState — adds local state to a component.
  • useEffect — runs side effects (API calls, subscriptions, timers) after rendering.
  • useContext — accesses shared data without passing props through every level.
  • useRef — holds a mutable reference that persists across renders.
  • useMemo / useCallback — optimize performance by memoizing values or functions.

Custom hooks let you extract and share stateful logic between components, promoting cleaner, more modular code.

6. Component Lifecycle and Rendering

Every React component goes through a lifecycle:

  • Mounting — the component is created and inserted into the DOM. (useEffect with an empty dependency array runs here.)
  • Updating — the component re-renders when its state or props change.
  • Unmounting — the component is removed from the DOM. (Cleanup functions in useEffect run here.)

React 18+ introduces concurrent rendering features like startTransition and Suspense, which allow React to prepare updates in the background without blocking the UI — making complex applications feel smoother.

What Is React Compared With?

React is often evaluated alongside:

  • Angular — a full framework with opinionated structure, built-in routing, and dependency injection. Better for teams that want everything included; React is more flexible.
  • Vue.js — a progressive framework with a gentle learning curve. Vue and React share similar component-based approaches, but Vue provides more built-in opinions.
  • Svelte — compiles components at build time instead of using a virtual DOM at runtime, resulting in smaller bundles. A newer approach gaining popularity.

React’s combination of ecosystem size, corporate backing, and community support keeps it as the most widely adopted choice for frontend development.

What Can You Build With React?

React is versatile enough for virtually any UI-heavy application:

  • Single-page applications — social media platforms, project management tools, CRMs
  • eCommerce storefronts — dynamic product listings, shopping carts, checkout flows
  • Data dashboards — real-time analytics, monitoring systems, business intelligence tools
  • Mobile applications — via React Native for iOS and Android
  • Design system component libraries — React is the foundation of most enterprise design systems

Getting Started With React in 2026

The recommended way to start a new React project in 2026 is with a framework:

  • Next.js — the most popular React framework, with server-side rendering, file-based routing, and API routes built in.
  • Vite + React — a fast, lightweight setup for client-side React apps. Run npm create vite@latest my-app -- --template react.
  • Remix — a full-stack React framework focused on web standards and progressive enhancement.

Note: create-react-app is no longer recommended by the React team. Use Vite or a framework instead.

For more detailed setup instructions, see our guide on how to run a React app locally.

Build React Interfaces Visually With UXPin

Understanding how React works opens the door to building better applications — and better design-to-development workflows.

UXPin Merge bridges the gap between design and code by letting teams design with real, interactive React components. Choose from built-in libraries like MUI and Bootstrap, or sync your own component library via Git. Every component is fully functional — with real states, props, and interactions — so prototypes behave exactly like the final product.

With UXPin Forge, you can also generate React interfaces using AI. Describe what you need, and Forge builds it using your actual production components — not generic placeholders. The output is clean JSX you can export and ship.

Start your free UXPin trial and build your first React interface today.

Frequently Asked Questions

How does React’s virtual DOM work?

When state or props change, React creates a new virtual DOM tree in memory, compares it with the previous one (a process called reconciliation), and then updates only the real DOM elements that changed. This makes rendering efficient because direct DOM manipulation is minimized.

Is React a framework or a library?

React is a library, not a framework. It focuses specifically on the view layer — rendering UI components and managing their state. You choose your own tools for routing, state management, and API communication. Frameworks like Next.js and Remix build on top of React to provide a more complete solution.

What is JSX in React?

JSX is a syntax extension for JavaScript that lets you write HTML-like markup inside your JavaScript files. It compiles to regular JavaScript function calls (React.createElement) during the build step. JSX makes it easier to visualize your component structure and is used by virtually all React projects.

What is the difference between state and props in React?

Props are read-only data passed from a parent component to a child component, similar to function arguments. State is mutable data that belongs to a specific component and can change over time, triggering re-renders. Props flow down; state is local.

Is create-react-app still recommended?

No. As of 2025, the React team no longer recommends create-react-app for new projects. The recommended alternatives are frameworks like Next.js or Remix, or a lightweight setup with Vite. These provide better performance, faster builds, and more modern defaults.

What are React hooks?

Hooks are functions that let you “hook into” React’s state and lifecycle features from functional components. The most common hooks are useState (for local state), useEffect (for side effects like API calls), and useContext (for shared data). They replaced the need for class components in most cases.

Use a single source of truth for design and development. Discover Merge

Logos

by UXPin on 24th April, 2026

UXPin is a web-based design collaboration tool. We’re pleased to share our knowledge here.

Still hungry for the design?

UXPin is a product design platform used by the best designers on the planet. Let your team easily design, collaborate, and present from low-fidelity wireframes to fully-interactive prototypes.

Start your free trial

These e-Books might interest you