React is a very powerful front-end library of JavaScript that can be used to define user interfaces and related components.
It is an open-source library that is maintained by Facebook.
It uses Virtual DOM that makes the app fast.
Also, It offers a rich set of features including, Virtual DOM, One-way Data Binding, Components, JSX, Conditional Statements and many more.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related ReactJS queries.
In this context, we shall look into how to install ReactJS on your Ubuntu 20.04 system.
To install ReactJS and running the respective applications on your Ubuntu 20.04 system, you need to perform the steps that follow.
You need to add the NodeJS PPA repository to your Ubuntu 20.04 system since a ReactJS application can only run on your system if NodeJS is installed on your system.
The said repository can be added with the following command:
$ curl –sL https://deb.nodesource.com/setup_14.x | sudo bash -
After that, you can install NodeJS on your Ubuntu 20.04 system with the following command:
$ sudo apt install nodejs –y
You can verify the successful installation of NodeJS on your Ubuntu 20.04 system by checking its version with the following command:
$ node –v
This will show the version of NodeJS on our Ubuntu 20.04 system.
Now you need to install Yarn on your Ubuntu 20.04 system, with the following command:
$ sudo npm install –g yarn
You can now create your first ReactJS application on Ubuntu 20.04 with the following command:
$ sudo npm init react-app myfirstreactapp
Alternatively, you can also create a ReactJS application with the command that follows:
$ yarn create react-app myfirstreactapp
It will take a few minutes for the successful creation of a ReactJS application.
After creating your ReactJS application successfully, you need to move to its project directory with the following command:
$ cd myfirstreactapp
Now you need to start your ReactJS application with the command shown below:
$ npm start
It will take some time for the development server to start.
You will be able to view your ReactJS application in your default web browser by giving your localhost address followed by port number ":3000".
This article covers the method of using ReactJS on a Ubuntu 20.04 system by installing NodeJS and required dependencies on it.
Finally, we demonstrated to you the usage of ReactJS by creating a sample application.
To install npm on Ubuntu Linux, login into your server as a sudo user and invoke the command below:
$ sudo apt install npm
Once the installation is complete, you can verify the version of npm installed using the command:
$ npm --version
To install the tool, run the following npm command:
$ sudo npm -g install create-react-app
Once installed, you can confirm the version of installed by running:
$ create-react-app --version
How to Install ReactJS on Ubuntu 20.04?
React or Reacts is a front-end JavaScript library that is used to develop UI components. It is managed by Facebook and open-source developers.
It makes it effortless to create and maintain interactive UI specifically for single-page applications.
Many developers are using it because of its flexibility, integrity, and its feature to bring Html directly into JS.
Many well-known corporations such as Facebook, Uber, and Instagram used the ReactJS framework to create interfaces.
To install npm, open up the terminal and type the following command:
$ sudo apt install npm
To verify if the installation is completed successfully, check the npm version through the command:
$ npm --version