React is a JavaScript library for building user interfaces from small pieces called components. It is a good next step once you can make a simple web page. This roadmap keeps you away from outdated setup advice.
What to know first
You do not need to be an expert. Be comfortable with:
- HTML structure and basic CSS
- JavaScript variables, functions, arrays and objects
mapandfilteron arrays- arrow functions, destructuring and template strings
- importing and exporting between files
If several of these are new, spend a week or two on them. React will feel much easier.
Do not start with Create React App
The React team announced in February 2025 that Create React App is deprecated. If a tutorial begins with it, look for a newer one.
Two current ways to set up
You need Node.js installed on your computer for either route.
With a framework
The React documentation recommends starting a new app with a framework such as Next.js or React Router. For React Router:
npx create-react-router@latest
With a build tool, to learn the basics
The docs also explain how to build an app from scratch. A small TypeScript project with Vite starts like this:
npm create vite@latest my-app -- --template react-ts
cd my-app
npm install
npm run dev
If TypeScript feels like too much at first, Vite also offers a plain JavaScript React template: use react in place of react-ts.
Your first component
Replace the contents of src/App.jsx (or App.tsx) with this:
import { useState } from 'react';
export default function App() {
const [count, setCount] = useState(0);
return (
<main>
<h1>Practice counter</h1>
<p>You pressed the button {count} times.</p>
<button onClick={() => setCount(count + 1)}>Press me</button>
</main>
);
}
What is happening:
Appis a component: a function that returns markup written in JSX.useState(0)gives the component a value to remember and a function to change it.- Pressing the button calls
setCount, and React draws the new value.
Try three changes: add a reset button, move the button into its own component, and show a message after ten presses.
A four-stage roadmap
- Components and props. Split a page into a header, a card and a list. Pass data into the card.
- State and events. Build a form that adds items to a list and removes them.
- Effects and data. Load data from a public interface, and handle the loading and error states. Read the React docs on learning before reaching for effects; many problems do not need them.
- A real project. Add routing, split code into folders and publish it online.
Project ideas that teach something
| Project | What you practise |
|---|---|
| Task list | State, lists, forms |
| Price calculator | Derived values, controlled inputs |
| Study timer | Timers and cleaning them up |
| Product catalogue | Components, search and filtering |
| Notes app | Saving data in the browser |
Habits that save time
- Type the code yourself instead of pasting it.
- Read the first error message carefully; it usually names the file and line.
- Keep each component small enough to understand at a glance.
- Commit your work with Git so you can undo mistakes.
- When an AI assistant writes code for you, ask it to explain each line, then rewrite it from memory.