Recently I have a couple of messages from developers wondering if Angular is losing popularity to React and VueJS and if it is still valuable to learn Angular.
The common pros React has over Angular is the smaller bundle size and it’s easier to learn but I took up the task to dive into the differences between the frameworks by coding a todo app in both and compare...
Comparing the basic workings
I recently coded a simple React todo app and noticed how these core Angular workings translate to React:
Input => function parameters (props)
Output => callback functions
Lifecycle hooks => useEffect
And that is basically the core of coding React apps, very simply speaking! Also, as in Angular, you would often use a Redux library for handling state in more complex applications.
In React, I found myself missing the services, IOC, RxJS which you probably can set up in React yourself if you want, but I like the completeness of an Angular app.
Why I still prefer Angular
Angular is a framework where React is a library. I like Angular’s completeness with much more official functionality (supported by the Google Angular team) than React.
Of course, this also makes it harder to learn but I have many more tools at my disposal with Angular out of the box. I like the outputs over passing callback functions and Angular’s opinionated way of doing things. This makes it easy for me as a consultant to work on new projects as the foundation is the same.
React is not all that bad either. I liked the simplicity and how useEffect represents all the life cycle hooks. But I also found myself writing more plain JS whereas in Angular I would have used some helper eg. map vs. ngFor.
All in all, I was much more efficient in coding the Angular todo app even after I learned the basic workings of React because of the extra helpers and tools at my disposal with Angular (out of the box at least).
The future of front-end frameworks
It is pretty clear that more and more of the frontend frameworks are going to be compiled into web components. Just look at Ionic, which is using Stencil to generate web components.
That means, in the future, frontend frameworks will just be a syntax for generating web components and the underlying runtime will be more or less the same. In that light, the performance will be more or less the same and it will be about which framework you are the most efficient in.
My advice to you
I advise you to pick the frontend framework, that is relevant to the area you want to work in and truly master it. Don’t dabble around before one is mastered. Master one and the others will be learned in days (Angular is the hardest to learn).
Then later, you might start to learn another framework which will be easy as you can bridge your knowledge from your mastery in one other frontend framework.
Angular, React and VueJS are all here to stay and should be used for different purposes, I recommend:
Use React for a SAAS company (faster load, no need for an opinionated framework, might need more flexibility)
Use Angular for companies with many projects (more official functionality out of the box and more standardized)
Angular is catching up on React performance-wise with Ivy, so performance is going to be less of a question and developer productivity is going to be the real selling point.