Pages

How to Install ReactJS on Ubuntu?

Steps to Install ReactJS on Ubuntu 20.04 and Ubuntu 18.04.

ReactJS is a JavaScript library used for creating interactive user interfaces. It is maintained by Facebook and a community of individual developers and companies. Create simple views for each state in your app, and when your data changes, React will quickly update and render just the right parts. 


When compared to its competitors, Angular and Vue JS, React is far superior. Its adaptability and ease of use have made it the go-to for creating both mobile and web-based applications. It's estimated that over 90,000 websites, including some of the biggest names in technology like Facebook, Netflix, Instagram, Airbnb, and Twitter, use React.


This article explains how to set up ReactJS on both Ubuntu 20.04 and Ubuntu 18.04.


Step 1: Installing NPM 

First of all we have to set npm "node package manager", which is a prerequisite for installing React on Ubuntu


To begin with, it's a command-line tool for working with Javascript packages, which means it can be used to set up and maintain a variety of different Javascript-based resources.


More than 800,000 Node.JS packages can be downloaded from npm, which is an online database of open-source software. Npm is free and easy to use. It gives you quick access to thousands of software packages that are available to the public.


Ubuntu Linux users can install npm by logging in as a sudo user and running the following command:


Command:

$ sudo apt install npm


Once the installation is done, you can use the command to check the version of npm that was installed:


Output: 

$ npm --version




Installing npm will also install node.js, and you can check the version of node that was installed with the following command:


Output:

$ node --version




Step 2: Installing create-react-app Utility

The create-react-app program is a tool that sets up your development environment so that you can make a React application. It's much more efficient than starting from scratch, saving you both time and effort.


Simply enter the following npm command into your terminal to install the tool:


$ sudo npm -g install create-react-app


After installation, you can verify the software's version by running the following command:


$ create-react-app --version


Output:



Step 3: Create & Launch Your First React App


The process of making a React app is very easy and uncomplicated. Using the steps below, we can build a React app we'll call tecmint-app.


$ create-react-app tecmint-app


It will hardly take five minutes to install all of the packages, libraries, and tools that are needed for the app. 




Once the app creation is successful, you will get a notification with the basic commands. You can run more commands to start managing the application.



Now, navigate into the app directory to run the application. Enter the below commands to see how to access the application on the browser


Command:

$ cd tecmint-app


$ npm start


The output below demonstrates how to access the application on browser.




Open the browser and look up the IP address of your server.


http://server-ip:3000




The above screen shows that the default React app is running successfully on Ubuntu. 


Final thoughts: 

Once you have completed the steps outlined above, you should now have successfully installed ReactJS and create react app on your Ubuntu. You can now begin building and deploying more React app on your Ubuntu device. You can make great user interfaces and web apps with the power of React at your disposal.


No comments:

Post a Comment

Make new Model/Controller/Migration in Laravel

  In this article, we have included steps to create a model and controller or resource controller with the help of command line(CLI). Here w...