r/angularjs • u/amcdnl • Mar 22 '16
I’m gonna puke if you compare Angular to React again; heres why!
https://medium.com/@amcdnl/i-m-gonna-puke-if-you-compare-angular-to-react-again-heres-why-2869e0853a14#.fnht0eipa9
u/simcptr Mar 23 '16
Just to twist this around, "I'm gonna puke if anyone else says Angular and React can't be compared" ;)
I understand that they do different things. They do. The sum total of Angular has more functionality than React by its lonesome, this is absolutely true. React is basically equivalent to Angular's directives (and maybe controllers). It doesn't give you services, a module system, an HTTP library, form handling, routing, animation, or promises.
The argument goes that, in order to compare apples-to-apples you've got to add libraries to React until it has all the features that Angular does... and in so doing, you now have to learn 15 libraries instead of "just Angular". But on that point, I disagree (or at least, I think that's a bit disingenuous).
One can do just fine writing a bunch of Angular directives, not touching $http or anything else. ...Until some data needs to be rendered from the server (go learn $http). Wait they're restful! (go learn $resource). And you want to add some routes (nobody uses ngRoute anymore, gotta install and learn ui-router). And validate/submit some forms (learn ngForm). But then the forms get really complicated (install and learn angular-formly).
It's the same story with React. If you want to build a complex app, you need to learn a lot of stuff, like the article says. Redux, Redux middleware for promises, and on and on.
Web development takes learning and a bunch of moving parts, there's really no getting around it. Angular at least packages stuff up for you under one umbrella library, and that's handy to a degree. Doesn't mean you're off the hook for learning it all, unfortunately.
Angular is like a big complicated engine - does everything for you, and you can get some aftermarket mods if you want. React is more like a lawnmower. Does one thing well, but if you want to turn it into a fully-functional car, it's gonna need some heavy modifications.
1
Mar 23 '16
Did you just compare an external library to $http?
Its literally built in. How is that at all comparable? It's like saying to go learn document.querySelectorAll as if it's not part of Javascript.
5
u/simcptr Mar 23 '16
Angular is already an external library, isn't it? I mean, yeah it contains $http. But you can add that on to React as well.
I'm not sure I understood you though - $http is part of Angular, it's not built in to JS like querySelectorAll.
3
Mar 23 '16
Why do you need redux and company to compare to react?
1
Mar 23 '16
Because angular contains a baked in way to deal with state management and other things. With react you need some sort of module (maybe redux maybe something else).
1
Mar 23 '16
You can pass props and use state.
8
u/buttonkop666 Mar 23 '16
GL with that.
3
Mar 23 '16
Why? Many React apps don't need the complexity of Flux (Redux).
https://builtvisible.com/hierarchical-composed-state-react-js/
1
u/JarredMack Mar 23 '16
Completely agree, and it's a point I often have to push with people when discussing them. They're both very different products for very different purposes. React is fantastic for creating components, but takes some work to wire up a full application; and Angular is great for creating an entire application, but overkill for just making components. It's definitely up to an experienced technical lead to make the call on the more suitable framework for a project.
1
u/vagol942 Mar 23 '16
Well, of course, one is full front end framework and the other is a render library.
...Or is it? Nobody makes applications with vanilla React, you always need some sort of state manager, let it be something you build, or Redux or something else.
And for me this is the core of the comparison, Angular is a batteries-included pack, it is heavily opinated and does pretty much everything. What happens if you DONT like the Angular way you are pretty much forced to use?
In that case React (and hence the things you will need to make a React based application) is a valid option. React does one thing and comes with a shopping list of suggestions for the rest, is always up to you to fill the gaps.
1
u/alexandernst Mar 25 '16
Couldn't have said that better. Angular vs React is the new apples vs oranges.
1
u/Rihx Mar 23 '16
Thats a log of unnecessary text... Its comparing Apples to Pumpkins. Angular is a framework, React is a library. Two very different things.