Skip to content

React Overview

What React is, its core philosophy, and why it dominates modern front-end development.

What you'll learn

  • What React is and the problems it solves
  • The component-based architecture and virtual DOM
  • How React differs from vanilla JavaScript and other frameworks
  • The React ecosystem and where to go next

Concept

What Is React?

React is a declarative, component-based JavaScript library for building user interfaces. Created by Facebook (now Meta) in 2013, it has become the most popular front-end library in the world. Unlike a full framework like Angular, React is focused on one thing: rendering UI. You bring your own routing, state management, and build tooling, which gives you flexibility.

The Core Ideas

React is built on three foundational concepts. Declarative means you describe what the UI should look like for any given state, and React figures out how to update the DOM to match. Component-based means you build encapsulated, reusable pieces of UI and compose them together like Lego blocks. The Virtual DOM is an in-memory representation of the real DOM; React diffs the previous and next virtual DOM trees and applies only the minimal set of changes to the real DOM, which is much faster than direct DOM manipulation.

Why React Instead of Vanilla JS?

In vanilla JavaScript, you manually query DOM elements, attach event listeners, and imperatively update the DOM as data changes. This becomes unmanageable for complex, stateful UIs. React lets you write UI = f(state) — the UI is a pure function of state. When state changes, React automatically re-renders the affected parts. This mental model scales from a simple counter to a massive dashboard.

The React Ecosystem

React itself is small. Around it sits a rich ecosystem: Create React App and Vite for scaffolding, React Router for navigation, Redux or Zustand for global state, Next.js for server-side rendering, and React DevTools for debugging. Learning React opens the door to React Native (mobile), Remix, and many other tools.

Getting Started

To create a new React project, the recommended approach is to use Vite: run npm create vite@latest my-app -- --template react and you have a fully configured development environment in seconds. Vite provides instant server start, lightning-fast hot module replacement, and optimized production builds. Alternatively, Next.js offers a more opinionated, full-stack starting point with server-side rendering built in.

Example

              // A minimal React component — the building block of every React app.
import React from "react";

function Welcome({ name }) {
  return <h1>Hello, {name}!</h1>;
}

// Compose components together like building blocks.
function App() {
  return (
    <div>
      <Welcome name="Alice" />
      <Welcome name="Bob" />
      <Welcome name="CoderNewbie" />
    </div>
  );
}

export default App;
            

This is JSX — a syntax extension that lets you write HTML-like markup inside JavaScript. Each Welcome component is reusable and receives data via props.

Try it

  • JSON Formatter

    React component props often come from JSON — practice formatting it.

  • Code Diff

    Compare two versions of a component to see what changed.

Common mistakes

The mistake

Thinking React is a full framework like Angular

The fix

React is a library for building UIs. Routing, state management, and data fetching are handled by separate ecosystem packages you choose yourself.

The mistake

Confusing the virtual DOM with the real DOM

The fix

The virtual DOM is an in-memory tree React maintains. You rarely touch the real DOM directly in React — let React handle reconciliation.

Practice React Overview

3 exercises

Practice React Overview

Look up unfamiliar terms

A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.

View glossary

Build real projects

Apply what you learned by building guided projects with starter code and solutions.

View projects

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors