Setting up a React app with Vite is incredibly fast compared to traditional methods like Create React App (CRA). Vite offers instant Hot Module Replacement (HMR) and an optimized development experience. In this guide, you'll create a React app with Vite in just 30 minutes.
Before starting, ensure you have the following installed:
Run the following command in your terminal to create a new React app using Vite:
Alternatively, using yarn:
Follow the prompts and navigate into your project folder:
Once inside the project folder, install the necessary dependencies:
Or if using yarn:
Now, run the development server:
Or using yarn:
 This will start a local server, and you can open your browser at the provided URL (usually http://localhost:5173 ).
A typical Vite React project includes:
Open vite.config.js and check if the react plugin is installed:
This should be done autmatically by the create vite command.
Open src/App.jsx and update it:
Save the file, and Vite will instantly update your browser with the changes.
When you're ready to deploy, build your project using:
Or with yarn:
This generates an optimized production-ready dist/ folder that you can deploy to any static hosting service like Netlify, Vercel, or GitHub Pages.
You’ve successfully created a React app using Vite in under 10 minutes! 🎉
With Vite, you get fast builds, optimized performance, and a smoother developer experience compared to traditional tools.
Happy coding! 🚀