Installing React in 2023: Farewell Create React App, Hello Vite React Project

Posted by


In 2023, creating a React project using Create React App might not be the best option anymore. Vite is becoming a popular choice due to its faster build times and improved developer experience. In this tutorial, we will learn how to install React with Vite in 2023.

Step 1: Install Node.js and npm
Before we can start setting up our React project with Vite, we need to make sure that we have Node.js and npm installed on our machine. You can download and install Node.js from the official website (https://nodejs.org). npm comes bundled with Node.js, so you don’t need to install it separately.

Step 2: Create a new React project with Vite
To create a new React project with Vite, open your terminal and run the following commands:

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

This will create a new React project using Vite with the template for React. You can replace "my-react-app" with the name of your project. Make sure to navigate to the project directory by running cd my-react-app after the project is created.

Step 3: Install dependencies
Next, we need to install the project dependencies. Run the following command in your terminal:

npm install

This will install all the necessary dependencies for your React project with Vite.

Step 4: Run the development server
To start the development server and see your React project in action, run the following command in your terminal:

npm run dev

This will start the development server at http://localhost:3000 by default. Open this URL in your web browser to see your React project running.

Step 5: Build your project for production
When you are ready to build your React project for production, run the following command in your terminal:

npm run build

This command will build your React project into a dist folder, ready to be deployed to a production server.

Step 6: Conclusion
Congratulations! You have successfully installed React with Vite in 2023. Vite offers a faster and more efficient development experience compared to Create React App, making it a great option for building React projects.

I hope this tutorial was helpful in getting you started with setting up a React project using Vite. If you have any questions or run into any issues, feel free to reach out for help. Happy coding!

0 0 votes
Article Rating
25 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@hassanbutt3694
2 months ago

thank u brother

@user-vl1li8lj5u
2 months ago

Thnx 😊

@HunzalaArshad-v1r
2 months ago

thank you so much sir

@monalisabehera8187
2 months ago

Framework is not selected 😢arrow key not working😢

@makwanasagar6958
2 months ago

thank you vary use full video

@sayansaha7375
2 months ago

Thank you so much for the tutorial. Keep posting these type of videos. 😊😊

@darsh_0791
2 months ago

Thank you, love from india

@kayalammu6756
2 months ago

thanks a lot

@nagasravanthiravipati1267
2 months ago

Thank you so much

@liyakathalimd1940
2 months ago

Thank you a lot sirr..

@susheelchaudhari4673
2 months ago

Thankyou sir

@TANISHPLAYZOFFICIAL
2 months ago

Npm run dev is not working

@SyedZohaib-no6gi
2 months ago

Love you Sir. Thanks for this simple and amazing video

@samisadik3962
2 months ago

How to uninstall it give a video please

@Immaybenotforthenextsecond
2 months ago

but the problem is how to specify the react version

@jonass_-yd3ww
2 months ago

Doesn't work. The terminal keeps telling me, it doesn't know "npm" 🙁

@I_need_knowage
2 months ago

thanks for the video

@cloudxgaming1993
2 months ago

In my case if i edit in my editor it does not update in browser, please help me, I don’t know why this error is showing

@prathameshjadhav2942
2 months ago

Really this video very helpful

@shamimkhan6651
2 months ago

Thanks so much for this tutorial