Creating a React app using Vite

Posted by






How to create react app with vite

How to create react app with vite

If you want to create a new React application with Vite, you can use the following steps to get started:

  1. First, make sure you have Node.js and npm installed on your machine. You can download and install them from https://nodejs.org/.
  2. Open your terminal and navigate to the directory where you want to create your new React app.
  3. Run the following command to create a new React app with Vite:


$ npm init @vitejs/app my-react-app --template react

This will create a new directory called my-react-app with a basic React app structure using Vite as the build tool.

Once the app is created, you can navigate to the new directory and start the development server by running the following command:


$ cd my-react-app
$ npm install
$ npm run dev

This will start the development server and open a new browser window with your new React app running. You can now start building your app using React and Vite.

When you are ready to build the production version of your app, you can run the following command:


$ npm run build

This will build the production version of your app in the dist directory, which you can then deploy to a web server or a hosting service of your choice.

That’s it! You’ve now created a new React app with Vite and you’re ready to start building your next great project.