To create a React app using Vite,
follow these steps:
Install Node.js: Ensure that Node.js is installed on your machine. You can download it from nodejs.org.
Create a React app using Vite: Open your terminal and run the following commands:
Step 1: Initialize a new Vite project
npm create vite@latest
Now after some time it will ask you for your project name. Simply enter your project name and hit enter again hit enter.
Select React Framework: After running the above command, you will be prompted to select a framework. Choose React and then select either JavaScript or TypeScript based on your preference.
Navigate into the project directory:
Once the project is created, move into your project folder:
cd my-react-app
Install Dependencies:
Install the necessary dependencies by running:
npm install
Run the development server:
Start the development server with:
npm run dev
After that it will show you an url for your app
You can either copy that link and paste it to your browser or control plus right click or simply use "o" + Enter it will also run you app on your browser
This will launch your app, and you can view it at http://localhost:5173/
by default.
That’s it! You now have a React app set up with Vite.