I feel like this is desperate grasping at straws. It is theoretically possible to make Angular nearly as fast or faster than React is out-of-the-box, but the pain involved in doing so is massive. Yes, it's easy with little 5-line code snippets, but try doing so in a reasonably-sized application. It's hell.
React makes it easy to be fast by default. You generally don't even have to think about performance, and if you do have to, it is very easy to grasp. You don't need to frantically search extremely poor documentation.
How to optimize a React application: Implement shouldComponentUpdate. Or if you want performance by default, just use immutable data structures.
How to optimize an Angular application: Keep your scopes small. Keep it under 2000 watchers. Pollute your code with one-way bindings. Still no improvement? Oh, you need to do one-way binding here, too, in some obscure way. Don't watch functions. Don't watch objects. No $broadcast or $emit. Don't have big arrays. Should I use $digest or $apply? Why is this watcher causing the digest loop to take 500 ms to execute? No filtering or sorting unless you want to go mad. Did I mention using filters causes $index to be invalidated? How the hell do I even find out what's performing poorly?
I don't even know if any of that is correct anymore. It's too painful to remember. I want to be liberated and forget the literal hell that is Angular 1.x.
It will never cease to amaze me how quickly people turn from in-love to "this is literal hell". I remember when I first started working with AngularJS and everyone was swooning and now a new shiny toy is out and the hatred is extraordinary.
Yes, it's easy with little 5-line code snippets, but try doing so in a reasonably-sized application
I've been on teams that have built AngularJS applications of enormous size. It isn't hell, at least, if you actually spend the time to understand how to properly use Angular. It's certainly not always straight-forward, but hell != difficult.
How to optimize a React application: Implement shouldComponentUpdate. Or if you want performance by default, just use immutable data structures.
If you honestly believe a large team developing a large application can shove immutable.js in it and get production-ready performance than you clearly haven't programmed large applications.
Furthermore, why are you comparing a view-manager (React) an entire front-end framework (AngularJS)? No $broadcast or $emit? Events have nothing to do with performance, but they are the antithesis of good Angular design. You should do $digest if you need watchers to fire in the current scope only, you should use $apply() when you want the root scope (all watchers) to $digest().
The one and only real problem with Angular was always the same: the docs were really, really bad. As a result a lot of people simply couldn't learn the framework, or at the very least couldn't learn to use it well. Some couldn't because learning without good documentation is tedious. That's a very fair argument.
The downside, however, is that it's now vogue to talk about how horrible AngularJS is and list off a bunch of grievances, the majority of which show that the person really didn't learn Angular, for whatever reason.
React is a great view manager. It has a host of problems as well, and more of those problems will become apparent when the framework ages, much as they did with Angular. And undoubtedly, we will eventually come full circle and have people whining about how horrible React is compared to JesusFramework 1.0.
Honestly the real reason, webdevs just like to whine about something.
I'm honestly curious what the host of problems you find React has.
I'm kind of jumping between Angular and React for two projects and I'm not sure I'm sold on either, but all I read about React and Flux (and soon to be Relay and GraphQL and whatever the hell else) is unfaltering praise and never any good criticism. I would love to see more opposing viewpoints for the above.
Animation support is weak. Most animation tools are pure JS animations.
The biggest issue I have is that React = Virtual Dom. The rest is just opinionated templating and organizational stuff. React hasn't been out that long and I honestly think that big picture Mithril took the same idea and implemented it much better.
Full disclosure: currently using Mithril on a project. I've used ReactJS on a medium sized project and still think it's a VERY good view library.
29
u/cgaudreau senior HTML9 engineer Jun 01 '15
I feel like this is desperate grasping at straws. It is theoretically possible to make Angular nearly as fast or faster than React is out-of-the-box, but the pain involved in doing so is massive. Yes, it's easy with little 5-line code snippets, but try doing so in a reasonably-sized application. It's hell.
React makes it easy to be fast by default. You generally don't even have to think about performance, and if you do have to, it is very easy to grasp. You don't need to frantically search extremely poor documentation.
How to optimize a React application: Implement
shouldComponentUpdate. Or if you want performance by default, just use immutable data structures.How to optimize an Angular application: Keep your scopes small. Keep it under 2000 watchers. Pollute your code with one-way bindings. Still no improvement? Oh, you need to do one-way binding here, too, in some obscure way. Don't watch functions. Don't watch objects. No
$broadcastor$emit. Don't have big arrays. Should I use$digestor$apply? Why is this watcher causing the digest loop to take 500 ms to execute? No filtering or sorting unless you want to go mad. Did I mention using filters causes$indexto be invalidated? How the hell do I even find out what's performing poorly?I don't even know if any of that is correct anymore. It's too painful to remember. I want to be liberated and forget the literal hell that is Angular 1.x.