Ensure that you have Node.js installed on your system.
You can download it from nodejs.org.
Open your terminal and create a new folder for your React project.
For example, let's name it
mkdir ReactApp.
Navigate to the newly created folder using the command line.
cd ReactApp
Run the following command to generate a new React app.
npx create-react-app demoReactApp
Move into the newly created app folder.
cd ReactApp demoReactApp
Launch the development server.
npm start
Open your preferred text editor, create an index.html file, and save it in your project folder.
Open your terminal or command prompt.
Run the following command.
npm init
Install Parcel as a development dependency.
npm install -D parcel
Install React and React-DOM.
npm install react
npm install react-dom
Run the following command to start a local development server.
npx parcel index.html
To create a production build, use the following command.
npx parcel build index.html
This guide will walk you through the steps to create a Vite project and run it using npm.
Use the following command to create a new Vite project:
npm create vite
After running the command, you will be prompted to enter the project name.
Choose a suitable name for your project.
After entering your project name, Vite will prompt you to select a framework:
Use your keyboard arrow key to select React.
After selecting the React framework, Vite will prompt you to choose the language type.
Use your arrow keys to select JavaScript
Install the project dependencies using the following command:
npm install
Now, you can run the Vite project with the following command:
npm run dev