Why Choose React?

There are big advantages to using React for enterprise projects.

I recently wrote an article about how to learn React. One thing I didn’t touch on was why you would choose to use React for a project. When you’re building something for yourself, it doesn’t matter much what software you choose. So long as you like it and it gets the job done, that’s good enough.

When you’re building a product or working with clients, the choice of software becomes much more important. So why choose React?

It’s Proven at Scale

React plays a key role in the largest social media platform in the world—Facebook. It’s proven at massive scale and has a dedicated team of developers at Facebook with hundreds of other contributors outside the company.

Why should this matter? Let’s imagine for a moment that you’re a technical manager. Maybe you’re the Director of Development or the CTO. Ultimately, you’re in charge of selecting software your company is going to use to build stuff. You ask your developers what they think, but ultimately you have to make the call. If it blows up, it’s on you, not the developers.

One of the first questions to ask is, “Who else is using this to build big, important stuff?” In the case of React, there is first and foremost the previously mentioned Facebook. React was originally developed for use on their ads dashboard—the place where they generate their revenue. They also use it on parts of the main Facebook site. If you have React DevTools installed, you can open it up on facebook.com to check out the parts that are built using React, but the point here is that Facebook uses React extensively on critical parts of their products.

Instagram, another of the largest sites in the world, is also built with React—both the website and mobile app. Netflix, Twitter, Uber, BBC, Airbnb, Dropbox, Lyft, and NBC.com (which the team here at Lullabot helped build) are a few other examples of large-scale applications that are built using React.

If you’re our hypothetical technical manager and you’re making a decision about what technology you’re going to use on a project with a budget that may run into the millions, it’s reassuring to know that your choice is battle tested. It’s also a good indicator of a healthy ecosystem around the software—good tools, supporting libraries, and training. This is certainly true of React—the ecosystem surrounding it is large and mature. You’ll also be better off when you need to add or replace team members because the pool of developers will inevitably be larger.

It’s Influential and Innovative

There are a number of software patterns and techniques that React has helped popularize. Among them, use of a virtual DOM, component-based architecture, declarative programming style, HTML-in-JS, CSS-in-JS and functional programming.

All of these things within React have been influential in the broader JavaScript community. When React first came out, the use of JSX—which is sort of an HTML-in-JS approach—raised a lot of eyebrows. Over time, JSX has mostly been embraced and has encouraged developers to reconsider previously held ideas about separation of concerns. One result has been the creation of CSS-in-JS libraries like Aphrodite and styled-components. Together, these have gone a long way toward realizing the potential of component-based architectures.

You may have also noticed a lot of talk about functional programming in JavaScript circles. It’s a programming approach that JavaScript is well suited to and React has helped fuel interest. An important library within the React ecosystem, Redux, has accelerated that interest to the point that React development now leans toward functional programming approaches.

It’s Just JavaScript

Much of the code written in a React application is plain JavaScript. Contrast this with a library or framework that has a large API and you’re looking at potential time savings in getting your team up to speed. Another way to think of this is that if you have developers that already know JavaScript, their existing knowledge will be quickly put to use instead of spending time learning how to use the new software.

I’ve seen this dynamic firsthand. A developer may not have a lot of React-specific knowledge, but they can usually pick up tickets because there are tasks that only require general JavaScript knowledge. They can learn the React stuff as they go and become productive relatively quickly.

A separate but related point concerns frameworks that do not use JavaScript, but rather compile to JavaScript. The most popular example of this is TypeScript. It’s an interesting language and offers some useful features, but it can add to the learning curve.

For many teams, the prospect of learning a new language and a new framework at the same time, can be daunting. Because these languages are used by a subset of JavaScript developers, they can also limit the pool of developers available to quickly step in when there is turnover on your team.

It’s Versatile

One of the most exciting things about React is that you can use use it to build apps across multiple platforms—web, mobile, desktop and other devices. This has been referred to as a “learn once, write anywhere” approach to building software. This isn’t a hypothetical benefit, either. Here at Lullabot we’ve seen clients use React to build apps across various platforms and move developers from one team to the next with minimal disruption. This is huge.

You can also reuse React Native code to publish your app as both an iOS and Android app. Remember our hypothetical tech manager? How attractive is it to have a team of developers with the flexibility to move from building a web app to a mobile app? As a developer, it’s also exciting to be able to move into a new area of development without starting from scratch.

In the past, it was possible to write “hybrid” mobile apps using web technologies and various helper frameworks, but they often had limited functionality and poor performance. React Native—the React framework for mobile app development—is different. It allows you to build apps that are indistinguishable from those built in Objective-C, Swift or Java.

And Finally…

We’ve discussed why React is a good choice. Nevertheless, React is just a tool. As you don’t use a hammer to cut down a tree, React isn’t right for every project or every team. 

For example, if you need very high performance, then choosing a framework like Preact perhaps makes more sense as the team at Uber discovered. One nice feature of Preact is that it shares the same API as React so it’s easy for a React team to take up. The point, however, is to go with the software that is the right tool for the problem at hand.

React obviously has a lot to offer. Here at Lullabot we like it because it helps us solve problems for our clients better than the alternatives.

Published in:

Get in touch with us

Tell us about your project or drop us a line. We'd love to hear from you!