The following are the basic steps to use React
and Vite
build a front-end project:
Installation Node.js
and npm
package managers. You can Node.js
download and install Node.js and npm
.
In a terminal or command line interface, run the following command to globally install the latest version of Vite:
npm install -g vite
Change into the directory where you want to create the project and initialize a new React project with the following command:
npm init vite my-react-app --template react
Among them, my-react-app
is the name of the project you want to create, --template react
specifying to use the React template to create the project.
Go into the project directory and install project dependencies:
bash
Copy code
cd my-react-app
npm install
Start Vite
the development server by running the following command:
npm run dev
Open a browser and type in the address bar http://localhost:3000/
to access the default page of the React application.
You have now successfully created a React
and Vite
scaffolded front-end project. You can start adding business logic and UI components to develop your application.
When you Vite
build React
an application with , Vite
it automatically uses the latest version React
and supports hot reloading, that is, after modifying the code, the browser will automatically update to show the latest changes. In addition, Vite
support TypeScript
and CSS
preprocessors, as well as a variety of plugins and tool integrations.