Below are the steps to create a new React project using Create React App:
- first install the Node.js and npm (Node Package Manager) on your machine. Below are the steps to install:
- Go to the Node.js website (https://nodejs.org/) and download the latest version of Node.js for your operating system.
- Run the installer package to install Node.js on your machine.
- Open a command prompt or terminal window and run the following command to verify that Node.js is installed:
- node -v
- the installed version should be displayed
- run below command to check npm version install:
- npm -v
- Open a command prompt(Window OS) or terminal window (Mac OS) and navigate to the Workspace directory where you want to create your new project.
- once you navigated to workspace directory, then run the following command to install Create React App globally:
- npm install -g create-react-app
create first react app:
- Once installed, run the following command from terminal to create a new React project:
npx create-react-app react-demo
2. Navigate into the newly created project directory:
3. Start the development server:
4. Open your browser and navigate to http://localhost:3000/. You should now see the default Create React App welcome screen as below:
5. You have successfully created you first react app. The project’s source code can be found in the src directory.
We prefer Visual Studio Code to open react app and to build react app. We will see this in our next lesson.