How to install ReactJS in Ubuntu?


ReactJS or React is an open-source front-end JavaScript library for building UI. You can use it as a base for developing single-page web or mobile applications. It is known for its flexibility and features like bringing HTML directly into JS.

ReactJS is developed and maintained by Facebook and community or individual developers and corporations.

In this article, I will discuss the steps to install ReactJS in Ubuntu Linux.

Prerequisites

You should have access to a user account with superuser privileges.

Installing ReactJS in Ubuntu

Follow the steps that are given below to install ReactJS on your Ubuntu system.

Installing NPM

NPM or Node Package Manager is a package manager for JavaScript and an online database of free and paid JavaScript packages which is maintained by npm Inc.

Use the following command in your terminal to install NPM on a Ubuntu system.

sudo apt install npm -y

You can verify the installation of npm by using –

npm --version

npm version

Install create-react-app utility

The create-react-app utility helps to set up all the tools required for building React applications. Use the following npm command to install this tool on your system –

sudo npm -g install create-react-app

You can verify the installation by checking its version –

create-react-app --version

create-react-app version

Create your first React application

You can use the following command to create your first React application on your system.

For example, to create an application named hello-react we will run the given command in our terminal –

create-react-app hello-react

creating app success

Now to run this application first move to the directory of created application –

cd hello-react

And then use the following command to run it –

npm start

start react app

Open a browser and use the given URL to open the application –

http://server-ip:3000

OR use the given URL if you want to open it on your local system –

http://localhost:3000

This will display the output as given in the image below.

hello react

To explore more about ReactJS you can follow ReactJS Official Documentation.

Conclusion

I hope you have successfully set up ReactJS on your Ubuntu system. Now for any query, you can write us in the comments below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.