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

Leave a Reply

25 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@hassanbutt3694
13 days ago

thank u brother

@user-vl1li8lj5u
13 days ago

Thnx 😊

@HunzalaArshad-v1r
13 days ago

thank you so much sir

@monalisabehera8187
13 days ago

Framework is not selected 😢arrow key not working😢

@makwanasagar6958
13 days ago

thank you vary use full video

@sayansaha7375
13 days ago

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

@darsh_0791
13 days ago

Thank you, love from india

@kayalammu6756
13 days ago

thanks a lot

@nagasravanthiravipati1267
13 days ago

Thank you so much

@liyakathalimd1940
13 days ago

Thank you a lot sirr..

@susheelchaudhari4673
13 days ago

Thankyou sir

@TANISHPLAYZOFFICIAL
13 days ago

Npm run dev is not working

@SyedZohaib-no6gi
13 days ago

Love you Sir. Thanks for this simple and amazing video

@samisadik3962
13 days ago

How to uninstall it give a video please

@Immaybenotforthenextsecond
13 days ago

but the problem is how to specify the react version

@jonass_-yd3ww
13 days ago

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

@I_need_knowage
13 days ago

thanks for the video

@cloudxgaming1993
13 days 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
13 days ago

Really this video very helpful

@shamimkhan6651
13 days ago

Thanks so much for this tutorial

25
0
Would love your thoughts, please comment.x
()
x