React is a JavaScript library for building user interfaces. It is maintained by Facebook and a community of individual developers and companies. React can be used as a base for the development of single-page or mobile applications. It is a powerful library to deal with complex projects in an easy manner. React Native, one of the most lovable hybrid mobile application development frameworks is also based on React. Here I am going to explain the installation and set up of a React App on Ubuntu platform.
1. Install Nodejs
Because React is a JavaScript library, it requires to have Nodejs(A JavaScript runtime) installed. 12.x is the current latest version of Node. Installation of Node.js 12.x can be done using the below command.
NPM(Node Package Manager) is needed to create a react app and it will be installed with the Nodejs installation itself. However, we can update it to the latest version using the below command.
sudo npm install npm@latest -g
3. Install Create-React-App Tool
Now we need to install a tool named create-react-app using NPM as global. We can create react applications using this tool easily.
npm install -g create-react-app
4. Creating a New React Project
After successful installation of create-react-app, we can create our first react application using it.
create-react-app awesome-project
Here awesome-project is the name I have chosen for my react project.
Note:-
We can also combine the steps 3 and 4 with a single command using NPX( package runner tool that comes with NPM 5.2+).
npx create-react-app awesome-project
Here NPX will temporarily install create-react-app and create a new react project named awesome-project.
5. Running the Application
The app we created can be run locally on our system.
cd awesome-project
npm start
This will opens up the react application in a new tab of our browser with the below URL.
React is a JavaScript library for building user interfaces. It is maintained by Facebook and a community of individual developers and companies. React can be used as a base for the development of single-page or mobile applications. It is a powerful library to deal with complex projects in an easy manner. React Native, one of the most lovable hybrid mobile application development frameworks is also based on React. Here I am going to explain the installation and set up of a React App on Ubuntu platform.
1. Install Nodejs
Because React is a JavaScript library, it requires to have Nodejs(A JavaScript runtime) installed. 12.x is the current latest version of Node. Installation of Node.js 12.x can be done using the below command.
2. Update NPM(optional)
NPM(Node Package Manager) is needed to create a react app and it will be installed with the Nodejs installation itself. However, we can update it to the latest version using the below command.
3. Install Create-React-App Tool
Now we need to install a tool named create-react-app using NPM as global. We can create react applications using this tool easily.
4. Creating a New React Project
After successful installation of create-react-app, we can create our first react application using it.
Here awesome-project is the name I have chosen for my react project. Note:-
We can also combine the steps 3 and 4 with a single command using NPX( package runner tool that comes with NPM 5.2+).
Here NPX will temporarily install create-react-app and create a new react project named awesome-project.
5. Running the Application
The app we created can be run locally on our system.
This will opens up the react application in a new tab of our browser with the below URL.
ORIGINAL