There is no doubt that React is causing a front end upheaval when it comes to choosing a method of coding interfaces. Angular feels like it’s been in the market for a long time. However, in reality, the framework as we currently know it was only released in 2016. React, initially released in 2013, only gained major publicity traction after Facebook changed their BSD license to MIT.
In hindsight, the Angular team should have called it something else since it is so far removed and very different from the original Angular.js and just let that one die a slow silent death.
So what’s the big deal with Angular? and why, exactly, are developers still using and recommending it?
React is more geared towards being as flexible as possible, giving developers the choice of architectures and structures. Angular, however, enforces a certain structure onto the project.
Angular operates on a highly opinionated architecture — which means that your Angular app has to be written in a certain way for things to work properly. While this may sound rigid, the major perk is that once you learn the structures, every Angular app that you’ll ever come into contact will have something similar.
You can always expect the three piece creation of css, Angular component and html for your view at minimum. With React, its flexibility is also its weak point where junior or new React developers can create without restrictions, baking into bad practices or shaky architectures. It’s not their fault, not really.
Best practices come to fruition after enough mistakes have been made and best known solutions come to light. Angular forces these solutions on you in order to maintain a sense of cohesion in the way things are done.
Historically, this wasn’t present in Angular.js. The original version of Angular had a more free reign approach, similar to React’s ability to coincide with any existing application. However, as applications grew and teams changed, there’s a higher chance of the application breaking separations of concerns, resulting in a glop of code that eventually needed to be thrown out.
Angular’s new and enforced approach to architecture solved this issue, resulting in applications that are uniformed with a certain level of industry standards enforced.
The CLI has come a long way over the years, generating bare bones templates that utilizes best practices and structures.
Yes. React also has a CLI too but there is a difference between the two semi-official tools.
As frontend development grows in complexity, CLI is a tool to help get things up and running much faster through generations of templates in spaces that you need and want. Angular’s CLI is robust with the ability to generate code on the scaffold generated, making it highly flexible when adding new logic and components into the application.
The bundling features built into the CLI also allows for further debugging and optimizations. Deviations are encouraged with the ability to configure your project setup and compilation processes. From what I can see, React’s CLI isn’t equipped with such functionalities, in part because it is only a UI library and isn’t as beefed up when it comes to potential code related usability features.
Highly Driven Community
Despite the knowledge hurdles that put off a lot of new front end developers when it comes to Angular, the community is strong and active, with locally run groups like Angular NYC. Google also advocates for Angular as well, running a full calendar of events on a global scale with 41 sponsored conferences and workshops this year — up by 10 events from 2018.
Every time Angular releases a new version, it is not discarding the old completely. Rather, it is adding any new features, revelations and optimizations. Due to the it being a framework — which results in a complete UI, state management and architectural system, among many things — it has more space to grow in potential and functionality than React.
There is no doubt that React is limited by its scope. However, it’s limitation is what makes the library popular (besides being affiliated with Facebook). But it is Angular’s native and built-in wide coverage that differentiates and retains a certain portion of the development community that React hasn’t quite able to convert.
The battle between Angular and React can be rather opinionated from both sides. But it is wise to note that they are two very different things in terms of scope and architecture that ultimately produce a front end solution. They both solve issues that the other doesn’t adequately address — and depending on the situation, one solution might be better than the other.