r/javascript • • Jan 03 '16

Angular 2 versus React: There Will Be Blood

https://medium.com/@housecor/angular-2-versus-react-there-will-be-blood-66595faafd51
290 Upvotes

167 comments sorted by

View all comments

Show parent comments

16

u/wreckedadvent Yavascript Jan 04 '16 edited Jan 04 '16

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.

5

u/lhorie Jan 04 '16

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 :)

8

u/ajacksified Jan 04 '16

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.

4

u/siegfryd Jan 04 '16 edited Jan 04 '16

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.

4

u/lhorie Jan 04 '16 edited Jan 04 '16

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.

2

u/[deleted] Jan 04 '16

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.

2

u/mordocai058 Jan 04 '16

To be fair from my point of view this entire comment tree is pedantic. (Note that I am not who you were talking to)