Ohoy, religious grounds ahead!
I have been working with both Angular and React applications and have been working for companies that have switched between using Angular or React. From outside, the two frameworks can look like substitutes as they are both single page application framework, but in fact, they are quite different and the switching cost from one to another can be huge, so you might want some knowledge to back up the decision. This is the blog post I wish I had read before making decisions on when to use what.
In short, the main differences between Angular and React is that Angular is a very opinionated framework that comes with many official libraries and a lot of official tools like the CLI. React is, compared to Angular, a very lightweight framework that doesn’t provide much more out-of-the-box than a component structure and the change detection technology. Libraries and tools like IOC, services, routing and form handling, unlike Angular, you have to either implement yourself or get from unofficial third-party libraries.
When to use Angular
Angular is very opinionated and contains lots of tools out of the box. This can be a huge time saver for corporations that have many projects as it is very easy to scaffold a new Angular app with the CLI that has everything a single page application needs to start building an app. You could, of course, use React for this also if you did build this template yourself and maintain it, but that would require just that. Also if the projects have many different people working on them and especially external consultants, the benefit of an opinionated framework is that if you have learned it once, you can be very efficient in a new project from the first day because you are working with the same standard.
When to use React
React is great for bigger custom applications as you are to either build the helper modules like routing, forms, and services/state management or find unofficial third parties. For some that want to build these modules themselves might enjoy not using an opinionated framework.
Because less tooling comes out of the box with React you would often implement the lower level parts yourself with vanilla JS.
There is no real difference in performance from Angular and React.
Angular is doing change detection with events and React is using a virtual dom. Both are implemented in a fairly efficient way. Both can be used efficiently or inefficiently which will have a much bigger say on how an app performs.
Making the decision
Making the decision whether to use React or Angular is about the fit in the organization. If your organization is bigger and you have many different projects it can make development and maintenance easier by streamlining the organization front ends to use Angular. If your organization is smaller and is creating fewer different front ends, eg. a SaaS startup, you might like the simplicity and flexibility of React. Because your only need to maintain one front-end project, you can easier manage a more custom project, instead of using a couple of standard libraries, like it is the case with a standard Angular cli app.
Do you need help with this stuff? Check out my FREE case study.
Did you like this post? New posts every week. Subscribe so you don’t miss any.