How to Install ReactJS on Ubuntu-22.04
React is a popular, open-source JavaScript library created by Facebook and a vibrant developer community. It’s lightweight, making applications load faster. React easily integrates with different projects, making it a go-to for various applications. If you want to build interactive user interfaces for single-page apps, React is a fantastic choice.
ReactJS, created by Facebook in 2011, is a JavaScript library for building fast, interactive user interfaces. Today, it’s one of the most popular choices for web and mobile app development, outshining Angular and Vue in both functionality and popularity.
Its simplicity and flexibility make React a go-to tool for developers. Big names like Facebook, Netflix, Instagram, Airbnb, and Twitter use it to power their apps.
In this guide, we’ll walk you through how to install ReactJS.
Update the System
# apt-get update
Install Necessary Dependencies
# apt install curl apt-transport-https gnupg2 software-properties-common

Install NodeJS
Node.js is a free, open-source, and cross-platform JavaScript runtime environment, essential for running ReactJS applications. To install Node.js, run the following commands:
# curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -

# apt-get install nodejs -y

Installing npm
also installs Node.js
. You can check the installed Node.js version with this command:
# node --version

When you install this, NPM (a JavaScript package manager) gets installed automatically. To check the installed NPM version, run:
# npm -v

Upgrade “npm”
# npm install -g npm@latest

# npm -v

Install ReactJS and Create an Application
Create React App is a handy tool that quickly sets up everything you need to build a React application. It saves time and effort by handling the setup for you, so you can start coding right away.
To install it, run this command:
# npm -g install create-react-app

After installation, you can check the installed version by running:
# create-react-app --version

Create & Launch Your First React Application
Creating a React application is quite simple & straightforward. We are going to create a react app.
# create-react-app local.bitscentric-app
This process takes a few minutes to complete as it installs all the necessary packages, libraries, and tools. A little patience goes a long way.


If the application is created successfully, you’ll see a notification with some basic commands to help you start managing it.
# cd local.bitscentric-app
# npm start
If you’re facing this error.

Install the web-vitals
package:
# npm install web-vitals

# npm start

Finally, copy the created link to the web browser and view your application:
# http://localhost:3000
# http://192.168.1.9:3000
