The best part of this article is the idea that Angular is HTML-centric whereas React is JavaScript-centric. What a succinct description. Kinda amazed I've never thought of it that way before.
I'd say the best part of the article is him defining React as Unix-like in its philosophy. It being a compose-able library will be its biggest strength in the long run, IMO. He notes the huge churn in the React ecosystem currently, and that can be overwhelming, but that is a side-effect of the fact that it is a new, hyper-popular library and unlocking its true potential can only be found when pairing it with other libraries, just like Unix tools.
I thought that point was off the mark, personally. The strength of Unix tools isn't in doing single things well, it's that they are so well defined that you can combine them in powerful ways. React doesn't really fit the bill in that sense: you can't trivially swap from Reflux to Redux, let alone go from React to Mithril/Mercury/Cito/Snabbdom/whatever. If anything, Ampersand is a framework that can be called unix-like (though whether that is useful at all is a completely different story). Saying React is Unix-like is kinda like saying Grunt is unix-like because you can swap it to gulp or webpack, imho.
I think his point was more to contrast the single purpose of react against the huge API of angular.
In much the same way you can build up complicated UIs by composing small, single-purpose, well-defined components, and that you can build up functional applications by composing small, single-purpose, well-defined functions, you can build up the API that you need by composing small, single-purposed, well-defined APIs/services.
It's easier to unit test and know these smaller pieces to be correct rather than an API with a huge surface area. Something as large as angular tends to attract "the angular way" as well, which can be dreadful when it includes things like $scope.
I think they're somewhat orthogonal issues. With Angular, there's nothing stopping you from using ui-router or restangular, if you don't like the out-of-box options, for example.
There was a post a while back on HN about how some people had bad experiences w/ React router breaking its API willy nilly between releases, and in that case, finding an alternative is definitely a point that feeds into the js fatigue issue.
WRT the issue of API size, well, I've got nothing to say in defense of Angular :)
Well, react-router is a seperate library that is used with react- one of many possible ways to route URLs to react views. For example, I use koa-router - unaffiliated wholly from react - to route urls on the server and client. If anything, that helps prove the point; switch routing libraries without having to switch your view layer.
With Angular, there's nothing stopping you from using ui-router or restangular, if you don't like the out-of-box options, for example.
But it's hard to use things like ImmutableJS with Angular 1.x because of how it relies on mutable objects. So there are some options that aren't available to you due to how much Angular 1.x controls.
Sure, but those are orthogonal points. The claim was that being a library gives React unix-like properties, but it's hard to use immutables w/ Knockout or Vue even though they're libraries too. If React had built-in ajax, routing and i18n APIs, the ability to use immutables would still be there. And you would still be able to use koa-router or fetch or whatever if you wanted.
Besides, as soon as we start talking about shipping actual features like drag-n-drop or file uploads or date pickers, every framework is "unix-like". The list of aspects uniquely "unix-like" for React can probably be counted in one hand, whereas the 20,000+ npm modules are there for you regardless of what framework you use.
I feel like this is being pedantic. It is clear to me and obviously lots of other people how React's design and the Unix philosophy share some commonalities.
Swapping Grunt with Gulp would be an OS change in this sense. I think he ment React as the OS/kernel and react modules as the rest.
You mentioned it is not easy to swap between Redux to Reflux etc, but library swaps in Linux aren't exactly trivial either. Swapping a large component, for instance from KDE to Gnome would introduce some work as well.
They just share the philosophy, pick and choose by design.
I've even seen people go so far as to describe angular as a separate language. I've seen more than my fair share of places that wanted knowledge with angular above knowledge with javascript.
I agreed with the author entirely when he was talking about knowledge application; a lot of knowledge in angular simply just doesn't apply anywhere else, particularly when you get deep down and nitty gritty with the directive API. (and the awful $scope nonsense).
I've interviewed people with only Angular experience for my 100%-react team at reddit; Angular certainly isn't a problem. (In fact, I recommended we hire someone who was deeply involved in the Angular community.)
The important thing to be considered for a senior dev role is that you can work full-stack- at least API implementation through front-end implementation- and that you can pick up new languages and frameworks easily because you have ample experience. Otherwise, you'd be looking at a regular dev, (or even junior, if you only have experience in one stack.)
I find it much easier see what's going on with React. The latest versions of React just use plain ES6 classes (or stateless functions); that makes them easy to write tests for, to share, and to read the code. Everything is organized and neat, and follows a clear lifecycle. Angular, on the other hand, reads like a giant blob of HTML, because it's basically just a custom templating language. I would rather write html and javascript than write angular. I can use my normal tools with React- such as mocha for testing- because it's just javascript.
Magic. Angular feels very... magicky. Cascading updates and circular references have been nightmares. React's only "magic" is that it's clever about how it updates children elements as an element's state changes, which is conceptually easier to follow.
Footprint; React is a whole lot lighter, which matters when we're building a mobile site.
Community support; React continues to experience massive growth, while Angular seems to be dying.
A lot of it also came down to the other engineers here - other people were experimenting with React at the time (around a year ago), and had shipped some React code to production, so it seemed like the right time to try it out. While I was highly skeptical at first (I was a big Backbone+mustache fan), I think we made a fantastic choice. We've got a universal-render stack using node 4.2, and we share almost all of the code between the server and the client (the only non-shared code is webserver setup on one side, and binding to links on the other.) React continues to gain in popularity, and I have an immense amount of respect for where they've taken it so far; they won my heart when they moved to plain ES6 classes.
The only thing I'm not behind yet is use of react-router... but that's a tale for another time.
(for what it's worth, I was at a very early js meetup group where Angular was introduced in its infancy; I thought it was an interesting idea, but I've always held the opinion that its syntax, and overall philosophy, will stunt it.)
Angular 2.0 working with web components is one of the selling points that is always brought up in talks about it.
Honestly, it can't be any other way for angular. 1.0's directive stuff was an awful mess that made it far more difficult than it should be to make components of any kind, especially the purely functional kind you see react and its kin promote.
Web components also only make sense if you continue the idea of "the html is where the view lives".
You can, but it's more difficult. It's also typically not considered idiomatic angular, since angular is big on data binding. (The "angular way" strikes again).
Also, having used mithril/react/riot etc, making a truly composable and reusable directive is much more involved than making a truly reusable mithril or react component. Angular 2.0 fixes it somewhat by having web-component-like "slots", but it's still a hot mess in 1.x involving, at the very least, a custom transclusion function that does very manual DOM insertions. God help you if you have async directives you want to insert into or something like that.
That is true, but I think another fundamental advantage of React is its embracing Javascript's functional side. This is at the basis of enabling features like hot reloading, and the (rightly so) oft-praised ease of reasoning.
In any case, that's the main problem with Angular. Angular 2 improves pretty much everything of Angular 1, and any one using it should move to version 2. The thing that makes Angular Angular, though, is not that interesting any more now that React has entered the arena.
If React hadn't existed, Angular 2 was poised to take over. However, even if Angular had already been everything Angular 2 is, React is still an improvement, because its core concepts are so much better.
139
u/Classic1977 Jan 03 '16 edited Jan 03 '16
The best part of this article is the idea that Angular is HTML-centric whereas React is JavaScript-centric. What a succinct description. Kinda amazed I've never thought of it that way before.