
Learn React
The world's most popular UI library. Build fast, interactive web apps from reusable components. Master hooks, props and state β and you can build anything from a todo list to a full-stack web application.
React at a Glance
Build UIs from components. Each component is a JavaScript function that returns JSX.
import React from 'react';
// A React component is just a function
// that returns JSX
function Greeting({ name, role = 'Student' }) {
return (
<div className="card">
<h1>Hello, {name}! π</h1>
<p>Role: {role}</p>
<p>Welcome to React.</p>
</div>
);
}
// Usage:
// <Greeting name="Alice" role="Developer" />
// <Greeting name="Bob" /> β uses default roleπ± Renders as
βββββββββββββββββββββββββββββββ β Hello, Alice! π β β Role: Developer β β Welcome to React. β βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ β Hello, Bob! π β β Role: Student β β Welcome to React. β βββββββββββββββββββββββββββββββ
import { useState } from 'react';
function Counter() {
// useState returns [currentValue, setter]
const [count, setCount] = useState(0);
return (
<div>
<h2>Count: {count}</h2>
<button onClick={() => setCount(count + 1)}>
+ Increment
</button>
<button onClick={() => setCount(count - 1)}>
β Decrement
</button>
<button onClick={() => setCount(0)}>
Reset
</button>
</div>
);
}π± Renders as
Count: 0 [+ Increment] [β Decrement] [Reset] After clicking + three times: Count: 3 [+ Increment] [β Decrement] [Reset]
function LanguageList({ languages }) {
return (
<ul>
{languages.map((lang) => (
<li key={lang.id}>
<span>{lang.emoji}</span>
<strong>{lang.name}</strong>
<em> β {lang.level}</em>
</li>
))}
</ul>
);
}
// Usage:
const data = [
{ id: 1, emoji: 'π', name: 'Python', level: 'Beginner' },
{ id: 2, emoji: 'βοΈ', name: 'React', level: 'Intermediate' },
{ id: 3, emoji: 'π¦', name: 'Rust', level: 'Advanced' },
];
// <LanguageList languages={data} />π± Renders as
β’ π Python β Beginner β’ βοΈ React β Intermediate β’ π¦ Rust β Advanced
What You'll Learn
Six modules from your first component to fetching data with useEffect.
Components & JSX
- Function components
- JSX syntax and rules
- Rendering to the DOM
- Fragments and keys
Props
- Passing props down
- Destructuring props
- Default props
- Children prop
State & useState
- useState hook
- Updating state
- State with objects/arrays
- Lifting state up
Events & Forms
- onClick, onChange
- Synthetic events
- Controlled inputs
- Form submission
useEffect
- Side effects
- Dependencies array
- Cleanup functions
- Fetching data
Lists & Conditionals
- Rendering lists with map()
- key prop importance
- Conditional rendering
- Ternary and &&

Explore the Web Front-End category
React sits on top of JavaScript and works beautifully with TypeScript. Make sure you know JavaScript and HTML/CSS before diving deep into React.
Frequently Asked Questions
What is React?
React is a JavaScript library for building user interfaces, created by Facebook (Meta) and open-sourced in 2013. It uses a component-based architecture β you build your UI as a tree of reusable pieces β and a virtual DOM that efficiently updates only what changed on the page. It is the most popular frontend library in the world.
Do I need to know JavaScript before React?
Yes β React is built on JavaScript. You should be comfortable with JavaScript fundamentals: functions, arrays, objects, destructuring, arrow functions, and array methods like map() and filter(). If you are not there yet, complete our JavaScript tutorial first. A solid JS foundation makes React much easier to understand.
What are React hooks?
Hooks are functions that let you "hook into" React features from function components. The most important ones are useState (for managing state that changes) and useEffect (for side effects like fetching data or setting up subscriptions). Custom hooks let you extract and reuse stateful logic across multiple components.
React vs Vue vs Angular β which should I learn?
React is the most popular and has the largest ecosystem and job market. Vue is simpler to learn and has excellent documentation. Angular is a full framework used heavily in enterprise. For most new learners, React is the safest choice β it opens the most doors and the patterns transfer to React Native for mobile. All three are excellent choices.
What comes after learning React basics?
Next.js for server-side rendering and full-stack React apps, React Router for client-side navigation, Zustand or Redux for global state management, React Query for server state and data fetching, and Tailwind CSS for styling. In the job market, Next.js + TypeScript is currently the most in-demand React stack.
Ready to build with React?
Free. No signup. No downloads. Just start.
Start Learning ReactNo account required Β· Always free
The Story of React
Real history, real companies, and an honest look at where Reactshines and where it doesn't β not just a feature list.
Where it came from
React was built inside Facebook by Jordan Walke and released publicly in 2013, originally to solve a real problem the Facebook News Feed team had: keeping a constantly changing, interactive UI in sync with underlying data without the app turning into unmaintainable spaghetti. Its core idea β describing UI as a function of state, and letting React figure out what actually changed on screen β was unusual at the time and is now industry standard.
How itβs actually used today
React (and its meta-framework Next.js) powers Facebook and Instagram themselves, along with Netflix's UI, Airbnb, Uber's dashboard tooling, and a large share of modern SaaS products. Because components are reusable, teams can build a design system once and reuse it across dozens of product screens.
Strengths & trade-offs
React's component model scales extremely well on large teams, but it's a library, not a full framework β you'll need to make (or adopt) decisions about routing, data fetching and state management that other frameworks like Angular bundle in by default. The ecosystem is enormous, which is a strength, but it also means there's more than one 'right' way to structure a project.
What to learn next
Most React developers pick up TypeScript alongside it fairly quickly for the safety it adds to larger component trees, and many move on to Next.js for server-side rendering, routing, and full-stack features once they're comfortable with plain React.