What is ReactJS?

ReactJS is a library which is developed by Facebook.
According to the official definition:
React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It lets you compose complex UIs from small and isolated pieces of code called “components”.
So basically, React is a library that lets you create small reusable components, which you can use to build complex UI. Each component can communicate with each other.


In this whole course, We will assume that you are familiar with JavaScript, HTML, and CSS. And we will also assume that you are familiar with programming concepts like class, function, object, inheritance etc.
If you don't know JavaScript and HTML, you should try our JavaScript tutorial and HTML tutorial.
We will be using some syntax of ECMAScript6. You should get familiar with that.

ReactJS: library or framework?

According to the official documentation, ReactJS is a library. It is a very debatable topic.
Difference between library and framework is Inversion of control. In a library, you call library functions but in the framework, you are called by the framework.
Frameworks define the entire application ecosystem while the library provides functionality on some parts of the ecosystem. If you need more functionality, you need to add another library.
For example, Angular is a complete framework that handles everything from state to view. While ReactJS handles only view part.

Pros and Cons of using ReactJS

It is not like that ReactJS is the best solution for your application. ReactJS comes with advantages and disadvantages. It depends on your application whether you should use ReactJS or not.

Advantages of ReactJS

  • Virtual DOM

    When you change any element in virtual DOM, it updates the only changed part in actual DOM but will not affect other parts of the interface. So virtual DOM makes apps faster.

  • Reuse the React components which makes development faster.
  • Small components help build the large application and it increases the readability.
  • ReactJS is easy to use with other frameworks and libraries. i.e It can be used with Redux easily.

Disadvantages of ReactJS

  • ReactJS only handles the view part of the application. So you will need other libraries to develop the full-fledged ecosystem. i.e To handle state (data), Redux is commonly used with ReactJS.
  • The documentation is poor in terms of integrating other libraries and frameworks. For a new developer, it is a little hard to integrate libraries like Redux in the ReactJS application.
  • ReactJS uses JSX by mixing HTML and JavaScript which is little complex and have the steep learning curve.

Which projects should use ReactJS?

The main benefit of ReactJS is virtual DOM. ReactJS does heavy DOM manipulation easily and well.
So if your application changes data and on that data changes, your entire view rerenders, then ReactJS is the answer to your application. Because ReactJS uses virtual DOM which doesn't rerender entire view but a single part whose data is changed.
You can also use ReactJS where your application can be divided into small components and each component can be used to create the entire application.


In this section, we have learned about ReactJS definition, advantages, and disadvantages of it, where it can be used, etc.
In the next section, you will learn the environment setup for ReactJS.