by jashmenn · 9y ago · 0 comments
I've written a book on both Angular 2+ and a book on React. I've talked w/ hundreds of developers on both sides and I can tell you that people with different constraints (and backgrounds) will have a different response.
The author of this article cites "more ReactJS libraries on npm" to imply that React is the better choice. Some people love a la carte infrastructure and the power that comes from choosing each element in your stack.
Some people love to have those decisions made for them, because they just want to build their app.
It's often cited that React is "simpler" than Angular, and if you look at just the core that's true. But by the time you pick a data architecture, styling choice, router, etc. you're back at the same level of complexity.
Actually in React, you've spent a lot of time researching which components you want (and if they'll even fit together). The pro here is that you get just the stack you want! The competitive evolution of these libraries means that you _can_ have 4 routers and pick the best. But also, if you'd just picked Angular, you just use their router and move on.
Here's another litmus test: Do you want 'string' templates or JSX? (Now, I know it's technically possible to do either in both frameworks, but it's almost never done in practice.)
Almost everything that seems "more complex" in Angular is a result of string-based templates. DI, AOT, the *ngIf and `let` syntax, is all because you're doing templates in strings instead of code. How do you feel about that? Would you rather write templates in JavaScript/JSX? Then use React. Do you have designers doing HTML on your team? Then use Angular.
(Also the other opens by citing webpack, npm, and third-party libraries as a React-specific benefit, but that makes no sense because angular-cli uses Webpack, it's on npm, etc.)
Everything you're talking about is great in a vacuum, but stable APIs and backwards compatibility is more important to organizations in the real world.
I can't trust Angular as a framework anymore, as past actions are indicators of future behavior.
Yet the end result was still the same. Another lesson in branding for Angular.
I think it's worth mentioning that the API for the largest one of these (react-router) has had breaking changes with every single release, and takes a totally new approach to routing each time. So the question is more, 'How do you feel about changing your approach to routing every time you write a new app?'
Or maybe I'm just too old and bitter for React haha
You can npm install react-router@^3.0.0 and keep using what you know.
My biggest problem with Angular is the sheer surface area of the API and the dependencies between the different modules. Angular as a framework has 10+ different components, all of which are deeply integrated. All of this is wrapped up in Zone.js which produces some of the least helpful stack traces in history.
A React app may be a composition of 4-5 key libraries (state management, routing, authentication and potentially a form helper) but each individual library has a much smaller API surface area and the decoupling makes it easier to debug.
I recently rebooted a project that was built in Angular in React after over a week of trying and failing to debug a wide range of subtle issues in our implementation of universal rendering which absolutely broke AoT compilation. I won't deny that there's a high possibility that our code was the problem - it's just that there were no useful stack traces showing where to look and digging through the different libraries was a mission and a half.
There's a lot to be said for composing a few independent libs with small APIs, rather than having a gigantic framework whose documentation is only skin deep.
I don't disagree with the facts-on-the-ground of your post, but I think you're drawing a mighty false equivalency and this line highlights it. The pro here, for a React-based stack is that you are forced to understand the tools involved well enough to make meaningful decisions (if you're a competent developer). By the time I was done evaluating routing libraries, I was confident in my ability to write my own, effectively--and so I didn't have to because I was able to adopt the library of my choice's mental model immediately. If you "just want to build your app", your app is gonna blow up (not might, will, given a long enough timeframe) and you're not going to be equipped to fix it.
Passive consumption is unwise for programmers. We've seen it bite people forever (be it the "all things come from Microsoft" era of .NET that they're just shaking now or the "Spring does it for us" era of Java or most of Rails pre-3.0).
The stump-dumb-simple routing layer of your JavaScript handwavey crap is one that You Really Just Gotta Know; it's literally central to everything you do in a SPA. And yet the overwhelming majority of AngularJS folks I have ever met--and, to their discredit, way too many keypuncher ReactJS folks, but a significantly smaller proportion--have no idea what to do if their web framework spits the bit. And my contention is that having to make choices means the likelihood of a baseline understanding of what chose choices mean is way higher.
There are plenty of capable developers who work on and choose to use AngularJS. I've worked with great ones. But, like the other environments I mentioned before, it sure seems like they brought that capability to AngularJS rather than had that capability fostered by AngularJS in a pedagogical manner. And that's troubling to me, because these folks are going to be writing software that you and I depend on, too. I'm not hanging people for not being able to work meaningfully with the JavaScript runtime or understand how the browser works internally (though these are handy to know, most of my knowledge of JavaScript comes indirectly from embedding first SpiderMonkey and then V8 in a game engine once) or how their OS handles process segmentation to sandbox off their web runtime environment (not a super complicated topic but, sure, out of scope) or how their OS handles memory (this one, ditto) or or or--I'm saying you gotta understand the thing your hands are on all the time and that tools that attempt to swaddle you in a nice comforting "you don't need to worry about that" are gonna put you in a real rough place when that doesn't hold.
There were no abstraction breaks. C++ compiled, the thing works, the same goes for ng2 with TS. Ng1 is just plain ugly, but works fine.
I like React/JSX, FRP, I hate the size of the bundles Angular spits out, the byzantine boilerplate required to put something on screen and to make components interact, but it works, and it comes as a full package, and it keeps getting better.
The design principles of Ng are sound. Ng1 was overcomplicated. Ng2 is okay-ish.
I think ng lacks the "documentation" that the React ecosystem must provide due to its separatedness/modularity.
But my main point is, that basically good developers will compare those routing plugins/libs, and those same devs can solve problems when ng2 spits at them. And newbie frontend devs jump on the React is small and simple hype train and take the first tutorial and then get lost in that jungle. (And I'm not saying this can't happen with ng1/2, but neither codebase is about teaching programmers, so that's a very fringe aspect of this topic.)
If you "just want to build your app", your app is gonna blow up (not might, will, given a long enough timeframe)
I feel pretty safe building stuff using technology (Java EE) that I only know the surface. (i.e. API) of.
I think that we should choose solid, well though out libraries that we wouldn't have to fix by yourselves.
and you're not going to be equipped to fix it.
This seems to be more of a problem in JS land where tecnologies seems to get born, hit peak popularity and die within a few months.
In such a case I guess it makes a lot of sense to choose stuff that I could rewrite myself.
I don't think it's relevant for evaluating tools.
It is only relevant when hiring as you would like to find developers that is competent enough to grasp low level stuff at least at a rudimentary level.
In this case some side interest in routing frameworks might be indicativ regardless if they prefer to work with angular.
Come on, that is not an honest reading. The author uses those numbers to demonstrate the health and maturity of the respective ecosystems. The power of choice is a bonus for those who choose to leverage it.