5 Reasons You Should Use React

From its launch in 1995, it took JavaScript ten years to become one of the world’s most popular programming languages. Part of that upswing in popularity was due to Ajax, which rolled out in 2005 (and would play a vital part in Google Maps and Gmail). Four years later, the debut of ECMAScript (a trademarked scripting-language specification) standardized JavaScript, opening the door to various implementations.

Since then, JavaScript’s execution speed has only increased, and it’s been used in server-side programming with node.js. JavaScript can also leverage some powerful libraries. Take jQuery, for instance, which became a fundamental part of JavaScript coding in Web development. Today, you’ll find 475,000 packages in the npm software registry, with over three billion weekly downloads.

Your typical developer can find a lot of utility in these collections of frameworks, libraries, and packages. (Some of the more heavyweight frameworks include AngularJS, which Google claims is the most popular framework for creating Single Page Applications (SPAs); there’s also Ember.js, which many considered the best framework for web apps a few years ago.)

All of those, however, might be eclipsed by the popularity of one framework in particular: React, released by Facebook nearly five years ago.

What is React?

In the words of Facebook, React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It’s not a full framework, so you will need some scaffolding to get it going. Scaffolding in this instance means enough code to do basic CRUD (create, read, update, and delete) against a database, plus other code so that you have the skeleton of an application. There are many tools available to get up and running, but the complexity can initially prove quite overwhelming.

Despite those difficulties, React has considerable developer uptake; in August, for example, it dominated as the top technology on Hacker News’ ultra-popular “Who Is Hiring” thread for the second month in a row, ahead of Python, JavaScript, AWS, and other ubiquitous platforms.

“While this demonstrates how strong React’s hold on the industry is right now, how long can a JavaScript framework remain on top though? History has not been kind to JS frameworks, so my guess is that React will start dropping down by the end of year,” read the text accompanying those rankings. “With Vue.js coming in as the top riser, it’s clear the competition is coming.”

Whether or not it falls from those magnificent heights at some point, Facebook seems intent on investing in it for the long term. At this year’s F8 developers’ conference, Facebook executives announced that a virtual reality (VR) library was coming to the framework, along with a major rewrite (dubbed “React Fiber”) designed to bring more speed and reliability.

With all that in mine, here are five reasons to explore React:

It’s Fast, Thanks to a Virtual DOM

The Document Object Model (DOM) is a programming interface for HTML documents in a browser. Accessible via JavaScript, it can change controls’ styles and content.

The DOM is tree structured; changes made to any element mean reflowing the content. React keeps its own virtual version of the DOM, and your code ‘marks’ changed elements as dirty, then updates dirty components. I’ve glossed over the details, but this article is a lot more in-depth.

It’s Versatile

I understand why people like having frameworks do everything for you; but it means that, for revamps, you’re limited to the same framework—or tearing everything down and starting from scratch. Once you adopt a particular framework, it shapes the entire website architecture.

As it’s only a view layer, React is interoperable with other frameworks such as Backbone.js, Angular.js, and more. That makes it versatile.

Easy Component Creation

Microsoft’s Office team has embraced React, resulting in the React-based Fabric component suite. React uses JSX, a hybrid of XML and JavaScript code to create components; after compiling JSX, it becomes a regular JavaScript object.

This JSX:

Click Me

Compiles to:

React.createElement(

MyButton,

{color: 'blue', shadowSize: 2},

'Click Me'

)

React is Used by Facebook

This is important because Facebook will likely continue to maintain and refine the framework (and release updates on a regular basis). Given how Facebook has more than a billion regular users who want their photos and updates delivered smoothly and seamlessly, it’s also fair to assume that the company’s developers will continue to make React faster and more powerful as time goes on.

There’s a Big Ecosystem

The complementary tools are an extensive set of open-source tools available to help you get started with React, either as client-side or full-stack. Add to that Editor Integrations, component workbenches, debugging, build tools, routing, model management, data fetching, testing and many UI Components, including some third-party paid components, and you should have more than enough to get you started on pretty much any project you can envision.

Conclusion

Although React is very good for the reasons I’ve stated, please bear in mind it’s a huge platform with a steep learning curve.

Comments

One Response to “5 Reasons You Should Use React”

October 12, 2017 at 12:26 pm, Tim McCarthy said:

To me, the way that React encourages you to mix your HTML in with your JavaScript is a *huge* code smell. This is exactly why I prefer Vue.js. It’s model-view-view model (MVVM) pattern is very elegant and simple, yet very fast and performant. It is also gaining a lot of momentum. Vue.js has basically taken the best parts of Angular and React and rolled them into one awesome framework.

Reply

Post a Comment

Your email address will not be published.