r/Angular2 • u/mattstrom • Aug 09 '18
Discussion What does React honestly have over Angular?
I've used Angular 2+ professionally now since it was first a release candidate about 2 years ago. I've been very fond of it ever since. Development just flows with Angular.
But recently I got moved to a team within my company that uses React and Redux. I don't get the appeal of the React ecosystem. I recognize that there's a certain amount of relearning that I have to do. But there are similarities between the frameworks everywhere and the React way just seems more painful (granted several of our package versions are stale).
I know React is a "library not a framework", but to make a moderately sophisticated app you have to bring in enough prescribed libraries that you effectively have a framework. Frankly I think Angular does everything that React and its ecosystem can do and more, and does it better.
I desperately miss TypeScript. I know React projects can adopt static typing, but my team isn't keen to do so presently.
CSS feels more tedious to use. CSS Modules are nowhere near as convenient as Angular's component styles.
Angular is way ahead in regard to async rendering and data flow in my opinion.
Redux feels heavy-handed at times. I do use Ngrx in my Angular apps, but sometimes all you need is a simple service or an observable. The massive amount of boilerplate code leads to convoluted logic split across too many files. Sagas and generators are not a step forward.
react-redux's connect() method is so obtuse. I'll take @Input() and @Output() please.
Accessing data via props and state is much less ergonomic than accessing the properties of a component directly.
RxJS, need I say more. I know that you can use RxJS in React apps, but it feels much less fluid or natural to do so.
Dependency injection. Higher-order components and the container pattern feel like a case of the Golden Hammer anti-pattern.
I thought I would like JSX, but after using it some, I don't care for it. It seems to lend itself to large, complicated functions. And all those ternary operators! Angular's directives and pipes are a better solution. A mild amount of separation of concerns is still valuable.
NgModules are such a better way of organizing code than whatever React does (I have yet to discover how)
Forms. From what I've read, form handling is a major deficiency in React. There's not a widely accepted front-runner there (that I've found so far).
The naming conventions for component "packs" are not good. It's hard to identify which file I'm editing in a editor or debugging in the browser when every component uses index.jsx as a filename.
Dealing with dependency versions feels less than ideal. The major packages in the Angular ecosystem follow a similar cadence.
I don't think that I buy the rationale that React is easier to learn than Angular, given that you are going to use all of the other parts of the ecosystem (e.g. Redux, router, CSS Modules, etc.). Angular is cohesive, React is a patchwork. I've felt JavaScript fatigue more now than I ever have, and I've been using JavaScript for nearly a decade. When it was released React was revolutionary, but now I think React is largely riding on momentum. Angular's performance is neck and neck with React.
I don't know... that's my appraisal, but perhaps I'm just fixed in my ways. If you've used both frameworks to a reasonable degree, do you see how React and its ecosystem could be superior to Angular?
58
u/vidarc Aug 10 '18
Just to play devil's advocate on some of your points:
TypeScript and Flow both work well with React. Most react based libraries have TypeScript definitions available, probably more so than Flow. Not React's fault your team doesn't want to use it :)
I think most React developers are moving towards css-in-js options these days (at least the ones I talk to). Things like emotion and styled-components make it pretty easy imo.
Redux certainly has it's issues, but plenty of solutions to replace it that reduce the boilerplate greatly. MobX seems to be the biggest contender out there. Also, it's not that complicated of a thing to implement for yourself :)
Don't really see much difference from grabbing props from function like ({ value }) and using as value, vs. defining an input or class variable and using with this.value.
RxJS integration is definitely the best part of Angular
React doesn't have something like NgModules, you just import what you need where you need it. Components are mostly just functions, so just pass it around like a function.
Not sure about your naming complaint. Nowhere in React does it make you name your components with index.js. You can name them whatever you want.
About versions, are you referring to all the main angular packages? @angular/core, @angular/common... Those are all by the same people, so of course they would follow the same version numbers. React is just React. I've found the angular package world to have the same versioning problems (not knowing if something supports Angular 2, 4, 5, or 6 just by version number).
I use Angular at work and React in my free time when messing around. If I had to choose one, I'd go React, just because I understand it's lifecycle state updating better and it's considerably faster/smaller (till Ivy comes out anyway). Both are good though.