5 ms·
React is a UI layer, but Angular was a full-blown framework with routing, services to handle business logic, and so on. "Sucking just in a different way" is re
by Sacho 8y ago
React is a UI layer, but Angular was a full-blown framework with routing, services to handle business logic, and so on.
"Sucking just in a different way" is reductive to the point of meaninglessness; For example, if I'm broke, life sucks in some ways, and if I'm a billionaire, life sucks in different ways, but still usually people clamor to be wealthier rather than poorer.
Angular's UI update mechanisms were(are?) miles worse than React. The prototype-based inherited scopes contained a ton of gotchas compared to React's prop-passing. The $watch mechanism inherently scaled poorly - changes were not localized and required going through all watchers! What's worse, the (primitive) mechanism to localize changes - local scope $digest, was essentially unused by the base framework and by pretty much any app developers(the documentation and the base directives would all use scope.$apply(), which caused a global digest, going through all watchers). There were several micro-DSLs that you had to learn in order to do iteration, filtering, sorting, etc. "Filtering" was a mess, leading to Ben Nadel's articles about it(e.g. https://www.bennadel.com/blog/2766-stateless-filters-don-t-apply-to-objects-arrays-or-ngrepeat-in-angularjs-1-3.htm https://www.bennadel.com/blog/2766-stateless-filters-don-t-a...). There are practically no lifecycle concepts that are exposed to the developer, leading to a lot of confusion on when a directive is instantiated and rendered, with a reliance on implementation details. Angular used a ton of confusing jargon - controllers(a directive provided by the framework), services/factories/providers(singletons with varying control over their instantiation), filters(actually formatters...), and so on. The name doesn't match what you would expect from it.
React improved on all of these things. While it has its own shortcomings(e.g. explicit passing of props leading to lots of boilerplate code), those exist for meaningful tradeoffs. This is why Vue and React are competing products, but they're both a massive step forward from Angular.
(Disclaimer: I haven't used "Angular", just AngularJS, but presumably calling React the new Angular means we're talking about AngularJS).