23 C
Texas
angeloma
Senior Writer and partner

How to install ReactJS on Ubuntu 20.04

Hello, friends. Ubuntu 20.04 is a good system to start developing applications and this is well known by most veteran developers. So, today I will show you how to install ReactJS on Ubuntu 20.04 as a first step so you can start using this tool for your web applications.

So, first, let’s talk about what is ReactJS

ReactJS is an open-source JavaScript library for developing user interfaces. It was launched in 2013 and developed by Facebook, which also currently maintains it together with a community of independent developers and companies.

React, as it is also known, represents a solid foundation on which almost anything can be built with JavaScript. It also makes development much easier, as it offers us many ready-made things, which we don’t need to spend time working on.

- Advertisement -

An example of this is that it is used to develop web applications in a more orderly way and with less code than if you use pure Javascript or libraries like jQuery focused on DOM manipulation. It allows views to be associated with data, so that if the data changes, so do the views.

For these and other reasons, many developers use it in their front-end projects.

So, let’s install it.

Install ReactJS on UBuntu 20.04

React, as we’ll call it, depends on NodeJS so the first step is to install it on the system.

So, open a terminal and update the distro completely.

sudo apt update
sudo apt upgrade

After that, add the NodeJS 14.x repository which is the version we will be working with.

curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -

When the process is finished, we can start the NodeJS installation by running the following command

sudo apt install nodejs

When finished, you will be able to check the version of NodeJS installed on the system.

node -v
v14.18.0

Now it is necessary to install a recent version of NPM to do so run

sudo npm install npm@latest -g

Output

/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
/usr/bin/npx -> /usr/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
added 70 packages from 27 contributors, removed 250 packages and updated 187 packages in 6.975s

To install ReactJS then, run the following command

sudo npm install -g create-react-app

Query the installed version to check that the installation was successful.

create-react-app --version
4.0.3

With this, we can start creating our projects without problems

Creating a new ReactJS project

To create a new project with ReactJS just run the following command

create-react-app example

You have to replace example with the name of your project. This will start the whole process of downloading and configuring the new project.

When the process is finished, you will see the following output on the screen

1.- ReactJS installed
1.- ReactJS installed

As you can see, you have some commands that you should use when needed. To check that everything went well, run

npm start

Now open a web browser and go to http://your-server:3000 or http://localhost:3000 and you’ll see a screen like this

2.- ReactJS on Ubuntu 20.04
2.- ReactJS on Ubuntu 20.04

So, ReactJS is ready and you can now create great creations with it. Enjoy it!

Conclusion

ReactJS is a great tool on the Front-end side itself gives us answers to many problems arising from the use of JQuery. So, in this post, you learn how to install it on Ubuntu 20.04

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article