Setting up react app with Vite.js
Welcome to Daily code crafter, in this video we will be setting up a react app with Vite.js. Vite.js is a next-generation front-end tooling that allows for extremely fast cold start and quick HMR (Hot Module Replacement) to enhance the development experience.
Prerequisites:
- Node.js installed
- npm or yarn package manager
Setting up the project:
First, we need to install Vite globally by running the following command in your terminal:
npm install -g create-vite
Next, we can create a new react project with Vite by running the following command:
create-vite my-react-app --template react
This will create a new directory called ‘my-react-app’ with a basic react project setup using Vite.
Running the project:
Navigate into the project directory and run the following command to start the development server:
cd my-react-app
npm run dev
This will start the development server and you will be able to see your react app running at http://localhost:3000.
Conclusion
With Vite.js, setting up a react app becomes a breeze and the development experience is greatly enhanced. Give it a try and see the difference for yourself!
Stay tuned for more daily code crafting tips and tutorials. Happy coding!