Why React is the future of JS development?
I have been using React for almost a year now. Today I will share with you why I think this library is the future for building fast, reliable frontend interfaces.
React’s performance is second to none
If your UI is lagging or is unresponsive for some time, it can cause users an unpleasant experience with your product.
Feature one for every project should be performance. This is an area where React excels in (unbeatable). It creates a copy of your DOM called the virutal DOM. When a state or a prop is modified, it re-renders that component and changes are made to the vDOM. It then compares the vDOM with the actual DOM and makes changes only to the affected document nodes .
When something goes wrong, it can be pain in the back to debug a JS code after it has been bundled. When you make a typo in React, it won’t compile and it shows you exactly where your error is. This behaviour radically speeds development.
Used in production
Facebook and Instagram use React in production on their websites. What drove me away from Angular is that v2 is not backward compatible with code written in v1.5. This means that you will not be able to upgrade a 1.5 app to Angular 2, or you will have to re-write your app in Angular 2. This is not the case with React since it is used in prod.
As the time of writing this article, version 15.3.2 takes only 147Kb (minified) of disk space. Keep in mind that React does not come with a router, animation helpers or an architecture implementation out of the box. Even if you add those, it won’t take more than 200Kb.
I choose React most of the time because it makes development much easier and errors more predictable. What do you think of React? Which librairies do you use?