Creating a React App and Installing react-router

Learn to install react-router in a React application.

Let’s develop an in-depth understanding of react-router by building a simple React application to maintain a contact list.

Creating a React app

In this lesson, we’ll use CRA (key: Create React App) to create a React app, but this is only one of several ways to develop one. The CRA template provides a development environment where we don’t have to configure different build tools. It’s best for building a single-page application, and it provides a friendly development environment and production optimization.

For those who are interested in more details on how CRA provides the above benefits, its official documentation can be found here. Other build tools, like Vite or Parcel, are also available.

Use the following command in the terminal widget below to create a React app with CRA:

npx create-react-app contact-list

If CRA isn’t installed already, then it will ask permission to install it. Type y to give the permission.

Once it downloads the required files, open the project directory by typing the following command:

cd contact-list

To see a list of files and folders, type ls or dir.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy