Why ReactJS for Web Development?

SthaRashmi
4 min readApr 3, 2021

If you are new to React.js then you must be in dilemma why to use react for your web application. Here’s the answer for your confusion.

After the uses of javascript have increased in recent years, we have multiple options available in market such as angular.js, vue,js etc . Then why React ?

Why Learn ReactJS?

ReactJS offers graceful solutions to some of front-end programming’s most persistent issues, allowing you to build dynamic and interactive web apps with ease. It’s fast, scalable, flexible, powerful, and has a robust developer community that’s rapidly growing.

Let’s explore some key reasons to use ReactJS

1. Fast Learning Curve

React is very simple and lightweight library that deals with view layer only. It’s not like other MV* frameworks such as Angular or Ember. Any developer who has hands on knowledge on Javascript can understand the basics and start developing an awesome web platform or application after a couple of days reading tutorial. As the React guide says ‘thinking in React’ may be a little different than you used to since it brings a new approach to the table, but it will become much easier and natural as you gain experience with it.

2. React is Flexible

React is a library, not a framework, you can use it on vast variety of platforms for building quality UI. React was created with a single focus: to create components for web applications. But as it’s popularity is grown, its ecosystem has also grown to cover various use cases. With react we can easily generate static site using tools like Gatsby, can use React Native for building mobile apps, can even create desktop applications using tool like Electron which can be run on mac and windows with React.js technology.

It also supports server side rendering of its components using tool like Next.js. You can also use React.js to create a virtual reality website and 360 experiences using react VR.

“Learn React Once and Write Everywhere”- Reactjs.org

3. Reusable Components

In React, reusable component is a piece of UI that can be used in various parts of an application to build more than one UI instance. React provide such component based structure. Each component has its own internal logic and decides how it should be rendered. As you can re-render component on the basis of your requirement. As a result,

  1. your app has consistent look and feel
  2. code re-use makes it easier to maintain and grow your codebase
  3. easier to develop app

4. Flux and Redux

Flux is an architecture that Facebook uses internally when operating with react. It is not a framework or a library. It is merely a replacement quite an architecture that enhances react and also the idea of unidirectional data flow. The overall structure is as follows.

Image from : https://facebook.github.io/flux/docs/in-depth-overview.html#structure-and-data-flow

Redux is a kind of reinterpretation of flux architecture. There is a single source of truth and uses pure functions in redux. We can define a middleware to intercept dispatched actions. Generally it is used for exception handling, async api calls etc but we can also write a middleware easily to solve all kind of other problems. Redux has a great dev tool which makes a lot easier for developer.

figure: Redux dev tool

5. Fast render with Virtual DOM

Web applications involves high user interaction and view updates which possibly may cause performance issue. DOM manipulations are still not fast. Updating DOM is usually the bottleneck when it comes to the web performance. React is trying to overcome form such issue by trying virtual DOM. The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM. This process is called reconciliation. The implementation of virtual DOM is the main reason behind React’s high performance.

6. React has Facebook’s Support/Resources

React is heavily used in the facebook app, website and instagram. Facebook is deeply committed to react. They use more than 50K components in their production environment. React team in facebook maintain their blogs that gives us detail for each release. Because of deep commitment by Facebook to react in production, when breaking change occur, Facebook provides Codemod that automates the change.

figure: Top four contributors of reactJS

Conclusion

For creating interactive applications for web, mobile etc, react is one of the best library. By using the concept of reusable component developer can create application within less code and time. Due to these advantages react has gained much spotlight.

--

--