How to Install and Set Up a React App

React is a popular JavaScript library for building modern user interfaces. If you’re new to this, getting your very first React app running can seem overwhelming, but believe me, it’s extremely straightforward.

Today, I will walk you through installing React using Node.js step by step, from installing Node.js to running your first React app in the browser.

Prerequisites

Before we begin, make sure you have the following installed,

  1. Node.js (14 or higher)

  2. npm (comes bundled with Node.js)

  3. A code editor like VS Code

You can check whether they’re installed by opening your command prompt or terminal and typing,

Type codes one by one

If you see versions, you’re good to go!

Step 1 — Create a New React App

The easiest way to start a React project is with Create React App (CRA) an officially maintained tool that sets everything up for you with no setup.

Run this command in terminal

npx enables you to run packages without globally installing them.

Replace my-react-app with the name of your project that you prefer.

Step 2 — Switch into Your Project Folder

Once installation is finished, navigate to your new project directory.

Run this command in terminal

Step 3 — Start the Development Server

Now, begin the development server,

Run this command in terminal

This will automatically open your React app in the browser at http://localhost:3000 .

You’ve successfully created and launched a React app!

1
Subscribe to my newsletter

Read articles from Chamali L Liyanage directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Chamali L Liyanage
Chamali L Liyanage

I am currently a student at ESOFT Metro Campus, pursing a HND in Software Engineering. I eager to learn new technologies and improve my skills.