To create a new React app, you can use Create React App, a command-line tool that sets up a new React project with a good default configuration. Here are the steps:
-
Install Node.js: Make sure you have Node.js installed on your machine. You can download it from nodejs.org.
-
Open your terminal: Navigate to the directory where you want to create your React app.
-
Run the following command:
npx create-react-app my-appReplace
my-appwith your desired project name. This command usesnpxto run Create React App without needing to install it globally. -
Navigate into your project directory:
cd my-app -
Start the development server:
npm startThis will start the app and open it in your default web browser at
http://localhost:3000.
Now you have a basic React app set up! You can start modifying the src/App.js file to build your application. For more in-depth learning, consider checking out LabEx labs on React!
