To create a new React project using Vite (which is currently the fastest and most recommended way in 2025), just follow these steps:
### Step-by-step: Create a React app with Vite
```bash
npm create vite@latest
npm create vite@latest react-auth --template react
```
You’ll be asked a few questions. Answer them like this for a React project:
```
✔ Project name: … my-react-app (or any name you want)
✔ Select a framework: › React
✔ Select a variant: › TypeScript (or JavaScript if you don’t want TypeScript)
```
Example with JavaScript:
```
✔ Project name: my-react-app
✔ Select a framework: React
✔ Select a variant: JavaScript
```
After it finishes, follow the instructions it shows:
```bash
cd my-react-app
npm install
npm run dev
```
That’s it! Your React app will be running at `http://localhost:5173`
### Quick one-liner (if you already know what you want)
JavaScript version:
```bash
npm create vite@latest my-react-app -- --template react
cd my-react-app
npm install
npm run dev
```
TypeScript version (recommended):
```bash
npm create vite@latest my-react-app -- --template react-ts
cd my-react-app
npm install
npm run dev
```
### Other available templates you can use
- `react` → React + JavaScript
- `react-ts` → React + TypeScript
- `react-swc` → React + JavaScript using SWC (even faster)
- `react-swc-ts` → React + TypeScript using SWC
### Why Vite instead of Create React App?
- ⚡ 10–100× faster dev server
- No more waiting during `npm start`
- Modern build tool (ES modules, etc.)
- Create React App (cra) is now in maintenance mode and not recommended for new projects.
npm install axios react-router-dom


0 Comments