← Learning Hub
Beginner

Create a Real React App

To build a real project on your computer, install Node.js (from nodejs.org), then create an app with Vite, a fast tool for starting React projects.

The examples in this course load React straight from the internet, which is great for learning but not for real projects. Real apps use a build tool that lets you split code into many files, import packages from npm, use JSX without extra setup, and create small, fast files for production.

Vite is today's popular choice: it starts in seconds and refreshes the browser instantly when you save. Frameworks built on React, like Next.js, add routing, server rendering and more for larger sites.

Example
npm create vite@latest my-shop -- --template react
cd my-shop
npm install
npm run dev

Open the address it prints (usually http://localhost:5173). Edit src/App.jsx and the page updates as soon as you save.

In a real project, import hooks at the top of the file:

Example
import { useState } from "react";

export default function App() {
  const [count, setCount] = useState(0);
  return <button onClick={() => setCount(count + 1)}>Clicked {count} times</button>;
}

What to learn next

  • React Router for pages with different addresses.
  • Loading data from an API with fetch inside useEffect.
  • npm run build creates the final files to put on your website.
Key points
  • Create real projects with npm create vite@latest.
  • Import hooks from "react".
  • npm run dev to develop, npm run build for the final files.

📝 Test yourself

1. Which tool does this lesson use to start a new React project?
2. What must be installed on your computer first?
3. Fill in the command that starts the development server:
npm run