To create a new React app, you can use the create-react-app
command-line tool. Follow these steps:
- Open a command prompt or terminal window.
- Type the following command and press Enter:lua
npx create-react-app my-app
Replace “my-app” with the name of your app.
Wait for the tool to finish setting up the new React app. This may take a few minutes.
Once the tool has finished setting up the app, navigate into the app directory by typing the following command and pressing Enter:
bash
cd my-app
Replace “my-app” with the name of your app.
To start the development server and launch the app, type the following command and press Enter:
sql
npm start
- Wait for the development server to start up and launch the app in your default web browser. The app should automatically reload whenever you make changes to the code.
Congratulations, you have successfully created a new React app! You can now start building your app by editing the code in the src
directory.
51