Site icon YourBlogCoach

How to Install reactjs and Create an app?

install reactjs

React is the most popular JavaScript library nowadays. It is a very fast, lightweight, and flexible library and easy to learn. It has two types ReactJS for web development and React-Native for mobile development.

Let’s start to learn how to install reactjs and create an app.

Download and install Node.js

Node.js is an open-source backend JavaScript runtime environment that executes the JavaScript code. Node.js comes with NPM.

And we need an NPM (node package manager) to install reactjs. For this, firstly you need to download Node.js and install it on your machine, if you have already installed then skip this step.

Go to the official website of Node.js.

Select the “Recommanded For Most Users” and it will automatically detect your operating system and download the current stable version.

Then you will get the “.exe” file, double click on it, and install it on your system.

After successfully installed, open your command prompt (you can also use Git bash terminal.) and run this command node -v and npm -v, it will show you installed version of it.

NPM version should be 5.6.0 or higher because it require for create-react-app command.

If you have an older version of NPM then run this command in your terminal.
npm install -g npm

Install create-react-app Package

To install reactjs, the create-react-app is the global environment and the best way to set up all the files automatically to start the react app. So, run this command in your terminal
npm install -g create-react-app

It will install this package globaly in your system with the file path is “users/*name*/.node_modules_global/lib/node_modules/create-react-app”.

Now you are ready to create your first react app.

Create React App

Hooray! you configured all the environment setup and now ready to create your react app.

So, go to your directory where you want to create an app and run this command in your terminal
npm create-react-app my-first-app

In this command, “my-first-app” is the folder name.

The installation process will some take time. It depends on your internet and system speed.

So, after successfully installed, you will see a new folder in your directory which you have gave the name in the command.

Now time to run this app in the browser. So, open that folder path terminal with this command.
cd my-first-app

And run this command to start
npm start

It will start your app in default browser on the 3000 port. You can change this port as per your need.

You will see the welcome screen of react app on this default URL localhost:3000.

It’s done! Hope you understand, how to install reactjs and create the first app with it.

Exit mobile version