React App is a popular tool for building UIs (user interfaces) on the web. If you are new to web development, you may wonder what React is and how it can help you create better user experiences.

In this tutorial, you will understand what React is and learn how to use NPM commands to get started with React, such as install and start.

So, in the following section, you will understand what react is. Let’s get started.

Understanding What React.js Is

React.js is a flexible JavaScript library that assists in building UI components. Facebook, now known as Meta, along with a large community of developers, released React on May 29, 2013.

Additionally, React.js helps developers create web pages that can update information quickly, making everything feel fast and smooth. That means it responds to user input and changes dynamically. This makes it a popular choice for building complex web applications.

Lots of people use and support React. It’s free and open for anyone to use, which means a lot of smart developers around the world help make it better.

By moving onto the section below, you will understand how React components work together like pieces of a puzzle.

How Does React Work?

When you create a React component, you define its behavior by writing code that describes how it should render based on its current state and any incoming data or props. The component’s state is managed by React, and any changes to it trigger a re-rendering of the component and its child components.

One of the key features of React is its virtual DOM (Document Object Model). The virtual DOM is a lightweight representation of the actual DOM, and it allows React to efficiently update the UI without directly manipulating the DOM. When you update the state of a React component, React will compare the new virtual DOM with the previous one and only update the parts of the actual DOM that have changed. This makes React faster and more efficient than other approaches to UI development.

React also provides a unidirectional data flow, meaning that data can only flow in one direction, from parent components down to child components. This makes it easier to manage and debug your application, as you always know where the data is coming from and where it is going.

Another key concept in React is the use of JSX (JavaScript XML), which allows you to write HTML-like syntax directly in your JavaScript code. JSX is not required to use React, but it makes it easier to create and manage complex UIs.

Anyway, in the following section, you will learn how to write an application using React.js.

Write Your First App with React

To begin, it is necessary to install a recent version of node.js on your computer. To install it, follow the instructions on the official page.

Once installed, you can verify NPM and Node.js by using the command below.


# Verifying Node.js
node -v

# Verifying Node.js
npm -v

If everything is ok, you can start your first app with React.js. Simply run the command below and follow its instructions.

npx create-react-app [react folder name]

After executing this command, you will need to wait for a moment while the folder is being downloaded.

Install React

If you take a look at this image, you will be able to see the packages that will be installed in the node modules folder, such as:

  • React
  • React DOM
  • React Scripts
  • with many other 209 packages.

And there are some commands that you can use to run your React app.

When you open the project folder, you’ll find two files called “package-lock” and “package.json.” You’ll also see three folders, which are named as follows:

  • The “node_modules” folder.
  • The “src” folder contains jsx, CSS, and so many others
  • the “public” folder displays the compiled file in the public access.

These files are all about webpack, a tool that helps you mix together JavaScript, CSS, and other files and put them into the public folder.

Right now, you don’t need to worry about what’s inside these files. We’ll go over what they do in our next lesson. Let’s concentrate on making your first React app instead.

Anyway, before getting started, you have to learn more about Node NPM.

Let’s start the React application with the following command:

npm run start

Once you run this React app through the previous NPM command, it will open the browser with this URL http://localhost:3000/.

React on Localhost

Let’s summarize it.

Wrapping Up

In this tutorial, you have gained an understanding of what React is and how it operates behind the scenes. Here is a summary in a few points.

  • React.js is a library created by Facebook that is very fast for web interactions by updating pages without a full reload.
  • It works with components and a virtual DOM for efficient, fast UI updates.
  • To start with React, install Node.js, then use npx create-react-app to create your app.

Thank you for reading. Happy Coding!