Why You Should Choose React Over Angular 2 or 1 For That Matter

I remember coding with Angular 1 back in 2013 or thereabouts. Using Angular 1 directives was pretty remarkable at the time. Angular had bold promises about enhancing HTML with custom elements and a whole lot more.

Then you had to deal with transclusion, dependency injection, factory services and a whole bunch of other mumbo-jumbo.

It was hard to see how all that chicanery made you more productive. On mobile, frameworks like Ionic Framework and a handful of others made the slog worthwhile. There were few alternatives at the time that came with a powerful backer like Google. Everyone was jumping on the Angular bandwagon, including Firebase and just about any serious JavaScript vendor with a mission to boogey.

So, About That New New JavaScript Framework…

In a little corner far away the Ember kids were grokking that. And when they came out to see us, the smoke from all the Angular directives and transclusions was enough to drive them back away into their little cave once again.

They were right, of course, duh! It was just that, in that Brave New World, it was easy to mistake factories and snake-oil for productivity. And StackOverflow had not even made it to the promised land! They were still using jQuery, ha! (And doing it very productively, I and a million programmers must add!)

If you were really brave, you could always go nuclear and use Backbone, but among its few faults, hype was never one Backbone weakness. Everybody more or less quickly clambered the Ember train or this shiny new Angular “bullet” train and failed to see the value of simplicity that was core to Backbone.

Until months later, you were slogging through a ton of abstractions that barely made sense. Productivity ground to a halt. An old boss of mine seemed skeptical of Angular’s benefits, and in retrospect, one had to be skeptical of Angular’s cost. It seems the Angular engineers had brought the worst ideas and “patterns” and antipatterns from .NET and Java and somehow transmogrified JavaScript into the worst incarnation of old EJBs. So much for experience! Barebones jQuery had to be better than that mess.

Let’s Start From Scratch

Then React came along and was bold enough to actually throw out all that gunk. Few of us thought so, of course, at first. The Angular love was just too fresh, the dream of the promised land too vividly etched in our programmatic minds, the high priests of Dependency Injection too ensconced in their Olympian perch in Mountain View that few even noticed the tremendous change that had occurred overnight.

See also  MSIs: Something Every Solopreneur Or Freelancer Should Know About

A bunch of crazy upstarts had dared to challenge the Emperor in his own backyard. And when you looked at it carefully, they had won!

Good riddance, I thought, when I finally learned React. No more transclusion, controllers, factory this n that, all the weirdness and un-JavaScript-like declarations and code repetition. No more boilerplate and spaghetti. React was simpler, and made plain sense. Why had somebody not thought of this before?

We could now go back to writing straight-up JavaScript like we were back in Backbone.js! But not quite.

React still came with some conceptual overhead, and some rather inelegant semantics. Wrapping your head around JSX was like trying to switch from a QWERTY keyboard to using the OODAA keyboard, like, “what exactly did you say we now need to do with our HTML”?

Still, after the disillusionment of those crazy Angular days, anything had to be better. And it was fast! Shadow DOM! Functional, stateless components! And Atom could understand it!

Then along came React Native, and for me that was really the game-changer. Mobile, the only thing keeping me in Angular, was gone. React Native was even better than anything that could challenge it. It still had bugs and had not even reached release, but in time it would just be better than any non-native solution. Angular was dead! Game over.

The Matrix Reloaded

The Return of Angular
The Return of Angular

So fast-forward and the Angular chefs went back into the kitchen, and swiped some good ideas from React, Ember, Backbone and everyone else, as best as one can see, and went at it again.

Out came Angular 2, like Saruman’s NEW and IMPROVED Uruk-hai, marching across Middle Earth to take over JavaScript everywhere!

And I kinda liked it. The components are nice, the directives, where you use them, seem to have been simplified, no more controllers and crazy patterns, unless you happen to live for that stuff. It actually runs faster. Uses ideas from the shadow DOM and dared to rethink its own idioms. I give em a lot of credit for that.

See also  Small Business Marketing Strategies That Will Help You Sleep Better

Mmm, I Thought We Were Here To Code JavaScript

The Angular 2 experience and productivity is much nicer than before, I have to say. However, I wish they had not made everyone learn TypeScript.

And no, TypeScript is not necessary, in my opinion. I fall much more on the CoffeeScript side myself. And I think ES6 and future versions of JavaScript do too. TypeScript is somewhat of a mess. It’s not a zero-cost super-set around JavaScript. It can slow you down considerably. And its benefits can be extracted much more painlessly with something like Facebook’s Flow and similar systems. Having a good linter and JavaScript style guide for your team can keep you fairly safe. And you can use something like Mocha to run tests that keep your code pretty safe.

So, this whole Angular 2 craze? I just don’t see it folks. I’m here to anoint the new king, and React.js it is!

React has spawned off really good side-effects like Riot.js, which in turn inspired Vue.js, and then you have MobX, Redux and a bunch of reactive libraries that have all kinda emerged out of this innovation.

What’s not to like? You don’t need Angular 2 or 1 for that matter. Grok straight-up JavaScript, not some pretentious static monster, and pick React, Vue, Backbone or Riot.js. Even Ember will be a solid alternative. Either way, you run a leaner, faster, more productive, more elegant system, or any subset of those four. Your team will thank you for it!

About the Author

Tendai Mutunhire is a startup React and Node.js developer. He may be found at TowersOfZeyron and hacking on startups like NomadHideout and UnicornPoach.

I help solopreneurs get MORE PROFITABLE in WAY LESS TIME, grow and scale their one man businesses into time independent 7-8 figure machines that make money even when you’re asleep. Learn how in my Renegade Solopreneur Profits Bootcamp.

Leave a Reply

Your email address will not be published. Required fields are marked *

Hey there. If you're reading this you must be a…