Create a React Project Using Vite
1. Check Node.js
Make sure Node.js is installed:
node --version
npm --version
2. Create React Project
Open Terminal / PowerShell and run:
npm create vite@latest my-react-app
Vite will ask:
Select a framework:
> React
Select a variant:
> JavaScript
For TypeScript, select:
React
TypeScript
3. Navigate to the Project
cd my-react-app
4. Install Dependencies
npm install
5. Start Development Server
npm run dev
You'll see something similar to:
Local: http://localhost:5173/
Open that URL in your browser.
6. Project Structure
my-react-app/
├── public/
├── src/
│ ├── App.jsx
│ ├── main.jsx
│ └── index.css
├── index.html
├── package.json
└── vite.config.js
Important Files
main.jsx — React application entry point.
App.jsx — Main React component.
vite.config.js — Vite configuration.
package.json — Dependencies and npm scripts.
Useful Commands
npm run dev # Start development server
npm run build # Create production build
npm run preview # Preview production build