Over the past two years, I’ve split my time between Angular and React. And if you’ve read any of my other posts like here, and here, and here (boom, internal SEO) you know that I favor React.
In this short article, I present a theory on how we got here and why I believe React will continue to grow.
Architecture Overview
You’ll often hear things like, “Angular is MVC and React is just the view” or “Angular is a framework and React is a library.”
What does that mean? And what are the advantages and disadvantages of each approach?
Put simply, it means that Angular has a lot more built in. In fact, if you compare the primary packages for both Angular and React, you’ll see that the main package for React is 2.7kb while Angular’s is 87.4kb. Angular is over 30 times larger than React!
A key reason many developers choose Angular is because you don’t have to make a lot of decisions out of the gate. It has a built-in Router, out-of-the-box dependency injection, and a handy HTTP client. It also comes with a fantastic form management system, style encapsulation, and a defined path to lazy loading.
React on the other hand specializes in calculating your UI tree and figuring out a performant way to update the DOM. Knowing what React can and can’t do is key to understanding the ecosystem.
So how do you go about adding features that aren’t built into React? How do React developers add in routing or make HTTP requests?
Simple. You find a community solution that fits your use case.
Multiple Sharks
While at BYU, my marketing professor taught me a valuable lesson: You need multiple sharks in the water.
He meant that you needed competition and would often throw out outside investment as an example. When seeking to raise money, it’s important to have multiple investors who were interested in your company. Multiple investors means more competition and more competition means a better valuation.
This simple idea is why React has succeeded and why it will continue to outpace Angular. React does one thing extremely well and leaves the rest to the “sharks”, open-source package developers who are all competing for the same “resources”, your installs.
While Angular has had some big wins (style encapsulation and forms) it also has some major issues — I’m looking at you Angular Router.
With a centralized team making all the decisions, I’m not convinced Angular’s velocity can match React’s velocity. In understanding how this simple difference affects the React ecosystem, I think you’ll begin to notice the quality difference in equivalent React and Angular solutions.
Conclusion
While you can create outstanding applications with both React and Angular, I think most new projects should be built on React. Plain and simple.