First React App
Table of Contents + −
In this article, we will create our first React application from scratch.
Create a New React Project
To create a new React project, we will use Create React App that we have installed in the previous setup guide.
-
Open Terminal: Open your terminal or command prompt or warp terminal.
-
Navigate to Your Projects Directory: Use the
cdcommand to navigate to the directory where you want to create your React project. For example:Terminal window cd path/to/your/projects -
Create a New React App: Run the following command to create a new React application named
my-first-app:Terminal window npx create-react-app my-first-appThis command will set up a new React project with all the necessary files and dependencies.
-
Navigate into Your Project Directory: Change into the newly created project directory:
Terminal window cd my-first-app -
Start the Development Server: Run the following command to start the development server:
Terminal window npm startThis will open your new React app in your default web browser at
http://localhost:3000.