React / 2 MIN READ
Create React Vite
The way I do it
From the original Fervor library. Examples may use older package versions.
Creating a React App with Vite
Introduction
Welcome to FrOnt3nd Tutorials! In this tutorial, we’ll guide you through the process of creating and running a React app using Vite. Vite is a build tool that offers fast and efficient development experience for building modern web applications.
Install Node.js
Before you start, make sure you have Node.js installed. If not, you can download and install it from the official website: Node.js Download
Install Vite
Vite can be installed globally or locally in your project. In this tutorial, we’ll install Vite locally.
- Open the terminal and navigate to the directory where you want to create your Vite app.
- Run the following command to create a new Vite app named “my-vite-app”:
This command will create a new directory named “my-vite-app” with the React template.npm init vite@latest my-vite-app -- --template react
Create a New React App
- Open the terminal and navigate to the “my-vite-app” directory that was created in the previous step.
- Run the following command to install dependencies:
This will install the required dependencies for your Vite app.npm install
Run Your Vite App
- In the terminal, navigate to the “my-vite-app” directory.
- Run the following command to start a development server:
This command will start a development server and open your Vite app in a new browser window.npm run dev
Get Live Feedback
Vite provides built-in hot module replacement (HMR) for fast updates. As you make changes to your code, Vite will automatically update the app without requiring a full reload.
Conclusion
Congratulations! You’ve successfully learned how to create and run a React app using Vite. Vite’s fast development experience and built-in features make it a powerful tool for modern web development.
For more advanced topics and in-depth learning, refer to Vite’s official documentation and other resources.