DEV Community


Posted on

Advantages and Disadvantages of React.js

React.js is a Javascript library created by Facebook. In recent years, it has become very popular over the likes of other javascript frameworks or libraries. So, in this post, I will try to discuss the benefits of using this library and why this has become the de-facto js library in web development.

Advantages of React.js

1. Flexibility: Since React.js is a _library _and not a framework, it offers control to the developer to use any style or pattern for development. The developer is not fixed to a particular pattern. However, there are certain best practices that one can follow while creating SPAs using react.js

2. Performance: React.js uses a declarative style of programming and at its core uses a Virtual DOM to track changes and render the DOM to the browser. It also supports Server-Side Rendering, which enables webpages to be quickly and seamlessly sent to the user. This all means web apps created using React.js are fast as well as resource efficient.

3. Reusability: React.js best practices include dividing the code into components, thereby creating component trees. State can be managed as per the granularity required and only components below in the tree would update. But, components also mean developer has to write less code and can reuse the code for similar components in different sections of the SPA. HOC pattern also exists so that different components can be processed in a similar way thus increasing reusability.

4. Speed of development: Owing to the reusability of components and various patterns along with vast and rich libraries available reduce the time required for developing apps using React.js very less. The developer community is also very active in this library.

5. Ease of learning: The learning curve for someone new to React.js is not very steep. Good knowledge of javascript is sufficient to be successful at developing apps using React. However, some may face challenges initially in using JSX which is the basis of the library. But knowing HTML5 and some basic knowledge of XML can prove really helpful in that case.

6. Testing is easier: React comes with Jest, a testing library made especially for React. Along with that, there are many other javascript test tools which can easily be used to test react apps. The declarative code is also easier to test from the user's perspective rather than testing implementation details.

Disadvantages of React.js

1. Rapid pace of development of React: React.js is a library which is still evolving. Every few years a major change is expected that changes the way of development. So developers need to be up to date with their knowledge. For example, in React 16.8 and above, they introduced the hooks and deprecated the use of class components and lifecycle methods.

2. Documentation: With such a rapid pace of development, the documentation does not always remain updated. Although this has improved recently and we get updated documents very quickly.

3. Only caters to the View part: Using React.js has been debated as being an overkill in many cases where developers have argued that in MVC pattern of developing web apps, React only creates the View part. So such complex logic handling capabilities are a waste. This is not very credible however, as handling some view logic using client side javascript libraries reduces network calls and seperates view logic from business logic. Using React reduces the use of the DOM and rather uses the client side memory to perform javascript operations only.

4. Extensive use of JSX: This is seen as one of the largest drawback of the library. It can be daunting for someone trying to learn React.js. But this can be overcome quite easily and the learning curve becomes flatter with some exposure.


So that was my take on the very popular library that is React.js. Personally, I have found React.js to be very easy to learn and stay updated with the extensive community support from so many talented developers across the world. I have been using React for 2 years now and I have not faced any major difficulty or setbacks in this time.

Top comments (0)