May 27, 2015

Why is Reactjs so significant?

Reactjs is built on a simple foundation of separating DOM mutations from the Views of the application. A typical SPA application renders and re-renders parts of DOM by a process of setting innerHTML on parent elements. This approach though simple and works for the most part, is mainly a hack around Web 1.0 applications where web pages were primarily rendered at the server. The browsers thus are built even today for Web 1.0 and hacked into the Web 2.0 world where pages are not rendered on the server but via a JavaScript application.

Some of the most popular libraries such as jQuery and BackboneJS provide simple API to do this rendering for applications. AngularJS takes an extreme approach to prevent excessive DOM mutation by managing all the data on the DOM separately.  ReactJS I believe is finally a right step into true Web 2.0 applications.

So what is the issue with DOM mutation? Why would re-rendering via innerHTML be an issue with the browsers today when they are so fast at changing DOM. I believe the main problem is the ugly user experience innerHTML renderers provide to the user. The flicker when a DOM element changes breaks the smoothness of an application and makes it look second grade. I believe that is the only reason, why web applications are unable to catch up with native applications.

Reactjs changes all that. It brings the smoothness and the experience back into web applications and provides the same level of experience that native applications provide. This I think is huge and is a paradigm shift in how web applications are typically looked upon. With the launch of React Native, we have finally arrived at a point where web applications will be at par with native applications. Its just a matter of time before browsers will understand the value proposition of Reactjs and build it as part of the DOM. Wouldn't it be great if we had an API such as morphHTML(target, html) as part of native DOM API's that does exactly what Reactjs provides?

All this development around Reactjs and React Native is truly exciting. I am looking forward to an internet where the web applications are no less than the best native mobile apps out there. And what will be exciting is when that becomes the norm rather than exception.