To create your first React app today, use Vite: run npm create vite@latest my-first-react-app -- --template react, install dependencies with npm install, and start the dev server with npm run dev. Create React App (npx create-react-app), which older guides recommend, is deprecated and no longer maintained.
This tutorial walks through installing Node.js, scaffolding the project, editing your first component, building for production and deploying the result.
The React team deprecated Create React App in 2025 and no longer recommends it for new projects. It relied on an aging Webpack setup, was slow to start, and received few updates. The React documentation now suggests either a framework such as Next.js or React Router, or a build tool such as Vite for a plain single page app.
For learning React and building client side apps, Vite is the simplest choice: near instant start up, fast hot reload and a small configuration. If you need server rendering, routing and data loading from day one, start with a framework instead.
Vite and React tooling run on Node.js, which includes npm. Install a current LTS release from the official Node.js website, then check the versions:
Vite lists a minimum Node.js version in its documentation, so using the current LTS release avoids compatibility problems.
Open a terminal in the folder where you want the project and run:
Replace my-first-react-app with your project name. Use --template react-ts if you want TypeScript. The dev server prints a local address, normally http://localhost:5173. Open it in a browser and you will see the starter page.
| Path | Purpose |
|---|---|
index.html | The single HTML page, with a div with id root |
src/main.jsx | Entry file that mounts React into the page |
src/App.jsx | Your first component |
public/ | Static files copied as they are |
package.json | Dependencies and scripts such as dev and build |
vite.config.js | Build tool settings |
The entry file creates a root and renders the app:
createRoot is the current API since React 18, and StrictMode runs extra checks in development to help you find bugs early.
Replace the contents of src/App.jsx with a small interactive component:
Save the file and the browser updates instantly without a full reload. Here, useState stores the number of clicks, and each click calls setCount, which tells React to re-render the component with the new value. Component names start with a capital letter, and JSX needs a single parent element, which main provides.
When you are ready to publish, create an optimised production build:
The build step writes static files to the dist folder, and preview serves that folder locally so you can test it. Upload dist to any static host, such as Netlify, Vercel, GitHub Pages or an object storage bucket with a CDN. If the app is not served from the domain root, set the base option in vite.config.js. If you use client side routing, configure the host to return index.html for unknown paths.
| Problem | Fix |
|---|---|
npm: command not found | Node.js is not installed or not on your PATH |
| Port already in use | Vite picks the next port, or set server.port in the config |
| Blank page after deploy | Wrong base path or missing fallback to index.html |
JSX syntax error in .js file | Use the .jsx extension for files with JSX in Vite |
It is deprecated and no longer maintained, so you should not start new projects with it. Existing projects can migrate to Vite or a framework.
Vite is a good fit for learning and client side apps. Choose Next.js or React Router when you need server rendering, built in routing or data loading.
You should be comfortable with modern JavaScript: functions, arrow functions, destructuring, modules and array methods like map.
Vite uses port 5173 by default. Create React App used 3000.
Install a current Node.js LTS, scaffold with npm create vite@latest and the React template, and run npm run dev. Edit src/App.jsx, then use npm run build to produce static files for deployment. Avoid the deprecated Create React App for new work.