React is an open-source JavaScript library that makes it painless to create interactive UIs, including simple design views for each state in your application. For developers looking for an open-source JavaScript library to build a cool user interface, React should be a great place to start. Because of its flexibility, developers can use React simple component logic to bring HTML directly into JavaScript instead of templates, and can also easily pass rich data through your app and keep the state out of the DOM. React was developed and is managed by Facebook and open-source developers. To get started with installing React on Ubuntu, follow the steps below:
Install Node.js
Since React is a JavaScript library, you will want to install Node.js. Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine and is a requirement for running React. For this post, we’re going to be installing Node.js version 14 and npm. You can install other versions that will suit your environment. After running the commands above, Node.js and npm should be installed and ready to use. To verify that it’s installed, run the commands below: That should display the Node.js version. When that is installed go ahead and install the Yarn package manager. The commands below can install it.
Create React App
At this point, you should be able to create apps in React. Run the commands below to create your first React app called myfirstproject. You can also use either of the commands below to create a project in React. After a successful build, you should get a similar message as below: Next, change into the project folder and start it. After the app is started, you should get a message below: A page should also open up to the app index. That should start up the project so you can start working on it. When you’re done and wish to deploy to projection, use the commands below: All your project files should be built and uploaded to the directory index. That should do it! Conclusion: This post showed you how to install ReactJs on Ubuntu 20.04 | 18.04. If you find any error above, please use the comment form below to report.