Should you choose Angular or React?
Why I choose Angular instead of React.
And why you should too.
I realize that this is an opinionated story. Take all of this with a grain of salt. In fact, don't even read it.
So… why do so many React fans think that Angular is a deep, dark framework to avoid?
Or that it's too hard to learn?
The opinionated framework - Angular.
Angular is a popular front-end framework used by Google and many others to build amazing web experiences. But…
…it's not the only option.
There's React which was built and maintained by Facebook.
Not to mention Vue.js which recently stormed the developer community.
So, which framework should you choose? Here are the 5 top reasons why I recommend Angular.
Reason 1: Typescript
The first time I heard about Typescript I thought it was a ridiculous idea. Say, why should I write Typescript and then turn around and compile it back into JavaScript?
My as well just use good old JavaScript even if it's cranky sometimes, eh?
That was until I discovered Angular. It takes Typescript and turns it into an amazing front-end language.
With Typescript, you don't have to worry about JavaScript's funky bugs and weird crashes. It doesn't allow me to pass a string as a parameter to a function that expects a number and cause weird issues like normal JavaScript would.
JavaScript is great. But Typescript is greater - and more so when you have a huge project. It enforces good development and best practices and makes developers behave when they're lazy.
Reason 2: The Angular CLI
The Angular CLI is a command-line interface tool that was created to rapidly initialize, develop, scaffold, and maintain Angular applications.
There's a React CLI floating around out there but I've never seen it mentioned in the official docs. Nor does it boast the features that the Angular CLI has.
The Angular CLI helps developers take care of the common and time-consuming tasks giving them more time to focus on coding. It simplifies the entire process of generating new apps, services, components and adding new libraries.
It is so simple to use that a 4-year old could create an Angular app if they wanted to.
Reason 3: Predictable Structure
Of all the JavaScript frameworks and libraries that I've worked with, Angular is the first front-end technology that actually feels clean and structured.
Angular projects are predictable.
One of my huge frustrations with other libraries and frameworks is the variation of coding and design practices I find… and I'm not the only one that gets frustrated. Here's what others have said.
I have to help with a react project at work right now which was developed by some hipster for our client. This hipster used FOUR different ways to create components! - Reddit
React ecosystem feels like a bunch of jQuery noobs just found a new toy. There are no rules, no guidelines, no structure, just a complete mess of random crap made by students. I don't miss jQuery days. - Reddit
I like React more when I'm writing it, but most React code-bases are pretty poorly architected. - Reddit
The Angular framework uses it's CLI and Typescript to provide a consistent way to develop, test and deploy applications. It's been blamed for being an opinionated framework. Yet this provides more consistency and makes larger projects easier to manage, debug and deploy.
Reason 4: Angular Components instead of JSX
I hated JSX and it reminded me of doing web apps in the late 90s and early 2000s where your code and markup was mangled together and no one did things the same way. - Reddit
Instead of putting HTML in your JavaScript file like React does, Angular separates concerns by splitting a component's code.
The HTML code goes inside an HTML file.
The Typescript code for that component goes into its own Typescript file.
The CSS for that component has its own CSS file and finally, we also have a test file used to run tests on that specific component.
Reason 5: Full-fledged framework
It's important to remember that React is only a library.
That means that by itself it is only useful for building user interfaces.
Angular is a framework meaning it has everything you need to build a basic application without installing 3rd-party libraries. For example, if you're going to do any HTTP request from your React application you'll have to install a library like Axios or Request.
Another example is Angular unit tests that come baked into any normal Angular application. Whereas with React, you have to install and configure a testing framework before you can start writing your tests.
After 5 rants, let's have a logical conclusion.
Finally, I want to emphasize that there is no right or wrong way.
Any mature developer will agree that both React and Angular are great projects. It's up to you what features are important and how you want the project to be built.
Angular Consultant & Freelancer