Have you ever wondered about React and React. js? Are they comparable to each other? Don't bewilder up your mind cause today, In this article, we will learn what React JS is and why we should use React JS, why to choose react and what is the accurate process of Installing React Js. Let’s move forward!

AN OVERVIEW OF ReactJS

React (also known as React.js or ReactJS) is a library of javascript that is used for building user interfaces. It is maintained by Facebook and a community of individual developers and companies. The most significant features of React is a major reality or the fact that you can generate components, which are like custom, reusable HTML elements that swiftly and efficiently develop the user's interfaces.

React uses a declarative paradigm that makes it quite easier for your application and aims to be both sufficient and more flexible. It is an open- source, component- based front end library of javascript that is only reliable for the view layer of the application. And if talk about the declarative view that makes your code more easy and more predictable to debug.

Besides, React streamlines how the data is stored and handled using the state and props. Subsequently knowing the significant sketch of React or React js, it’s time to take a dive and know some of its best features.

NOTE: React is not a framework. It lets you compose complex UIs from small and isolated pieces of code called “components”. It is just a library developed by Facebook to solve some problems that we were facing earlier.  


What are the ReactJS Features?

Currently, ReactJS obtaining quite agile popularity as the most reliable JavaScript framework amid web developers. It is playing a crucial role in the front-end ecosystem. Now, we are going to provide you the essential features of ReactJS in the following section. Let us take a closer look at some important features of React.

  1. Lightweight DOM For Better Performance
  2. Easy Learning Curve
  3. Components Support And Little Dependencies
  4. A desired interface can be created in a relatively easy manner.
  5. Error boundaries
  6. Easy to understand, declarative error handling

How do you Install React?

As you already aware of what react is in actual. It is a library of JavaScript, so saying install might sound a bit weird. Probably the word Setup is a better word, but you get the concept.

There are many ways to Install React we are going to show you in the below section so that it can simply work on your site or any app.

Getting React up and running is not as simple as downloading one large piece of software. You will need to install many, smaller software packages.

Step 1: Environment Setup


Getting React up and running is not as simple as downloading one large piece of software. You will need to install many, smaller software packages.

Here, the first thing to install is a good installer! You need a way to download and install software packages easily, without having to worry about dependencies.

Moreover, you can install npm by installing Node.js. Node.js is an environment for developing server-side applications. When you install Node.js, npm will install automatically.

a. Ctrl-click here to navigate to the Node.js homepage in a new tab.

b. You should see links to download Node.js.

c. Click on the download link of your choice. Follow the subsequent instructions to install Node.js and npm.

d. If you’ve already installed Node.js, that’s okay, do it anyway.

Congratulations! You’ve just installed some incredibly powerful software!

As a browser can not interpret JSX(Explained later in this tutorial), we need to first convert it into JavaScript. BABEL will do it for us on a fly and take care of cross-browser compatibility.

a. Open a command prompt and type “npm install -g babel”

b.  Install Babel CLI by typing “npm install -g babel-cli”


Create a folder on desktop so that you can locate it easily.

a. Run following command to create package.json file …..\Desktop\FolderName>npm init

b. Type  “npm install react --save” in command prompt. --save will update the package.json file with the packages.

c. Type ”npm install react-dom --save” in command prompt.


Bundler. webpack bundler will bundle the dependencies & JSX code together.

a. Type  “npm install webpack --save” in command prompt.

b. Type “npm install webpack-dev-server --save” in command prompt.

c. Install Babel dependencies(In the same folder which you have created in the previous step)

d. Type “npm install babel-core --save” in command prompt.

e. Type “npm install babel-loader --save” in command prompt.

f. Type “npm install babel-preset-react --save” in command prompt.

g. Type “npm install babel-preset-es2016 --save” in command prompt.    

Step 2: Create project file

Here, in this step, you need to create following files in the folder you have created in previous step.

a. Index.html

b. Main.js

c. Webpack.config.js

Step 3: Webpack & Babel

In order to run your first app you need to instruct webpack on which file to target as entry point. Also, we will configure babel-loader to use es2016 and react presets which we have installed in previous steps.

Step 4: Update Package. JSON

Update package .json’s scripts section file with the following script to initiate webpack. You must replace the test script to start the webpack server. We don’t need to test script as we are not going to perform testing in this tutorial.

Step 5: Create Index.html file

Step 6 : App.jsx and main.js

This is the first React component. We will explain React components in depth in a subsequent chapter. This component will render Hello World.

APP. JS

Here we need to import this component and render it to our root App element, so we can see it in the browser.

MAIN. JS

NoteNow, you need to note one thing that whenever you want to use something, you want to import it first. If you want to execute the component applicable in other portions of the app, you need to export it after the invention and import it in the file where you want to use it.

Step 7: Running the Server

Here, at this step the setup is complete and we can initiate the server by running the following command.

Which types can we use?

There are some of the ProtoTypes that we can use. These are the fundamental types we can accept:

  • PropTypes.array
  • PropTypes.bool
  • PropTypes.func
  • PropTypes.number
  • PropTypes.object
  • PropTypes.string
  • PropTypes.symbol

We can accept one of many values:

We can accept an instance of a class:

We can accept any React node:

or even any type at all:

Arrays have a special syntax that we can use to accept an array of a particular type:

Objects, we can compose an object properties by using

Bottom Line

Now that we have a rough understanding of what React is, What is the major process of installing react, further we can move onto something more technical. It's time to get a small project up and running.

You can leave your kind reviews or feedbacks in the below comment section. Enjoy learning!