In SitePoint’s forums I stumbled across a thread entitled So Many Frameworks where Guido, confused at the sheer number of options available, was asking which JavaScript framework he should adopt to make his application more dynamic. Given what I’ve been seeing in the industry and having used it myself, I stated that React had already won the client-side war. Fighting words like those need a bit more explaining, so here goes.

React is not just the hot new kid on the block, but a unifying paradigm. It can serve as a foundational technology for web applications that we can build on top of with confidence, knowing that it will not be replaced next month by its hotter cousin. Let’s take a look at React’s place among the current crop of MVC frameworks, exploring its strengths and ending with a prediction about where JavaScript development is headed in the future.

Client-Side MVC

[author_more]

For the past few years many smart people have been trying to build the perfect framework for making single-page apps — applications rendered by JavaScript which have improved perceived performance by responding instantly to user input and data changes over time. Guillermo Rauch’s article 7 Principles of Rich Web Applications is one of the best rationales for why this is important and the things we should consider when building them.

You can find examples of how these types of applications are built at TodoMVC, as the name suggests they have traditionally been made up of Models, Views and Controllers.

React enters from left of stage

When React was first announced it looked a little odd. It focused solely on the View layer, and had no Models or Controllers. The code examples were written in a strange syntax called JSX which appeared to many like a backwards step towards Ye’ Olden Days where it was common to mix HTML and JavaScript together.

No information was given on how you should structure your application other than that of a component hierarchy — composable chunks of UI that could re-render efficiently whenever state changed. React took a few notable stances against popular ideas that existed in this space, features like two-way data binding and templating were blasted as bad ideas that are best avoided.

Widespread Adoption

React quickly achieved critical mass. It’s hard to find JavaScript related mailing lists, conferences or meetups that don’t mention React these days. All of the local development teams in my city seem to be adopting React and contrary to other popular frameworks the verdict seems unanimous — everyone who I’ve spoken with has touted the merits of one-way data flow, component hierarchies and simple explicit renders, making the task simpler and the code more predictable.

React’s adoption has been surprising to me because of how volatile the JavaScript scene is. We rarely so broadly agree on anything. There are pockets of people loyal to one framework but most of us have jumped from framework to framework getting frustrated along the way with certain patterns that introduce complexity and bugs. I haven’t yet heard of a single case of people moving away from React due to these frustrations, not since jQuery has it seemed like we have had such a clear winner out in front.

You Had One Job React, One Job.

Its focus on the view layer means that it’s considerably less opinionated than other frameworks that attempt to solve every problem. Its wafer thin API means that there’s really not much to learn and it doesn’t warrant more than a handful of pages of documentation. This is a great help to those learning and it makes development simpler too, as you don’t have much cognitive overhead. Wherever possible, React opts for plain JavaScript constructs and language features rather than custom APIs or templating languages.

This design is also attractive to JavaScript developers who seem to favor focused utility libraries such as Underscore and Moment which do one thing well, very much the Unix philosophy. Doing one thing well has also allowed room for people interested in the project to contribute their own pieces to the React ecosystem. As a result of this projects like React Router, Redux and CSS Modules have arisen.

Continue reading %Forget Angular & Ember, React Has Already Won the Client-Side War%

Source: http://www.sitepoint.com/feed/