Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Creating a React-Based Project | React in Practice
Introduction to React

Creating a React-Based Project

In this chapter, we will learn to set up a React project.

Facebook (Meta) has developed a toolchain called create-react-app that easily creates a single-page React application.

It is perfect for developing single-page applications and for learning React so we will be using it in this course.

If you haven't already installed Node.js, you'll need to download and install Node.js from the official website.

Once downloaded, we will cd into an appropriate directory where we want to create the project and run the following command:

Where <app name> should be replaced with the application name. We will create a new app called webapp:

If create-react-app is not installed on your PC, it will automatically prompt you to install it:

Pict

You can press y and Enter to proceed, and it will automatically install it for you. It will continue setting up the project, and when it's done, it should look something like this in the console:

Pict

This means that the project is now all setup and ready to use. There should be a folder called webapp in the current directory. It should have the following contents:

Pict

Inside the console, we will use the cd command to move into the webapp directory, and then start the app, we will use the command npm start. This will start a node server hosting our React project at port 3000 and address 127.0.0.1 or localhost. In most cases, it will automatically open a browser window or tab with the website open, and if not, then we can type this address in the browser to view the app: localhost:3000.

Pict

To stop the application, we can go back to the console, press CTRL + C, and enter Y. In the next chapter, we will explore the structure of this React application in detail.

What is create-react-app?

Select the correct answer

Everything was clear?

Section 3. Chapter 3
course content

Course Content

Introduction to React

Creating a React-Based Project

In this chapter, we will learn to set up a React project.

Facebook (Meta) has developed a toolchain called create-react-app that easily creates a single-page React application.

It is perfect for developing single-page applications and for learning React so we will be using it in this course.

If you haven't already installed Node.js, you'll need to download and install Node.js from the official website.

Once downloaded, we will cd into an appropriate directory where we want to create the project and run the following command:

Where <app name> should be replaced with the application name. We will create a new app called webapp:

If create-react-app is not installed on your PC, it will automatically prompt you to install it:

Pict

You can press y and Enter to proceed, and it will automatically install it for you. It will continue setting up the project, and when it's done, it should look something like this in the console:

Pict

This means that the project is now all setup and ready to use. There should be a folder called webapp in the current directory. It should have the following contents:

Pict

Inside the console, we will use the cd command to move into the webapp directory, and then start the app, we will use the command npm start. This will start a node server hosting our React project at port 3000 and address 127.0.0.1 or localhost. In most cases, it will automatically open a browser window or tab with the website open, and if not, then we can type this address in the browser to view the app: localhost:3000.

Pict

To stop the application, we can go back to the console, press CTRL + C, and enter Y. In the next chapter, we will explore the structure of this React application in detail.

What is create-react-app?

Select the correct answer

Everything was clear?

Section 3. Chapter 3
some-alt