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.
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.
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.