16 ms·
I'd offer the opposite perspective: I started a recent app in React, and I wish I'd stuck with Angular. The core of the React render model is beautiful. It's f
by stupidcar 8y ago
I'd offer the opposite perspective: I started a recent app in React, and I wish I'd stuck with Angular.
The core of the React render model is beautiful. It's far quicker to start writing and using a new component in React than in Angular, and the functional nature of React components feels good and highly productive. At first.
But the problem is, around that beautiful core, the React community has built a mass of libraries, meta-frameworks, techniques and practices that are decidedly less beautiful. After a while, I really found myself missing features from Angular, and struggling to replicate them by wiring together a hodge-podge React++ framework. Instead of being productive, I was wasting an inordinate amount of time trying to discover what the current micro-framework de-jour was for handling a particular problem in React.
For example, Angular supports view encapsulation. So you can write CSS targeting a component, and the framework will ensure that the style rules you write apply only to the HTML rendered by that components, without leaking to other parts of the app. This really is a godsend for properly isolating components in a reusable way. With React, there's a myriad of libraries for doing CSS, but most seem to be abandoned, and none seem to offer as straightforward or as easy style encapsulation as what Angular provides out of the box.
It was a similar story with forms. Which are a rich, reactive API in Angular, but seem to be an afterthought in React. And with dependency injection, both of singleton services and components elsewhere in the hierarchy.
I expect if you go all in on Redux, you can eventually build up a reasonable facsimile of what Angular provides. But from a standing start I think Angular is a much more productive framework, just because it's actually trying to be a framework, whereas React seems to be stuck somewhere between being a UI library and a framework, leaving the community to somewhat badly fill in the gaps.
- chrisco255 8y agoReact's functional components and JSX abstraction lend to it's ability to render to any target, which is powerful in and of itself. Furthermore since they are all-in-one functions or classes, they are composible and flexible in a way that Angular components are not. The component is the core of a complex UI program. Worth the up front cost of researching the top one or two solutions for forms or CSS management, and gaining all the benefits of the massive React ecosystem, in my opinion, as well as having the flexibility to evolve more easily when things change (as they always do), than buy all in on a framework. Especially for long lived applications, flexibility and adaptiveness is paramount.
- jontro 8y agoFor view encapsulation I really recommend using https://github.com/styled-components/styled-components https://github.com/styled-components/styled-components We use this in all our react projects and we haven't had any problems since with leakage
- smuemd 8y agoCheck out this pattern http://meiosis.js.org http://meiosis.js.org Works great along w react
- PunchTornado 8y agoyour comment proves his point exactly.
- pygy_ 8y agoThe Meiosis pattern cristalizes the essential complexity of centralized state management (flux/redux), with no boiler plate, and little to no extra library code... How does that prove his point?
- 11235813213455 8y agoIt seems they don't want to have to choose a user-land library, but expect everything to be provided by the framework
- azr79 8y agoAnd that's exactly what he's talking about, and how many patterns do you have? Because we only have one, the Angular way, you can't imagine how an opinionated framework simplifies the life of working in large teams and hiring new people that can be productive quickly because they all pretty much follow the same design guidelines
- city41 8y agoI like the flexibility React provides. I’m working on two React apps right now. One using Apollo and the other Redux. The two libraries fit each app’s unique needs very well. One app really is a single page (it’s a drag and drop design tool) and so doesn’t have a router. I like that I can just bring in exactly what I need.
- Bizarro 8y agoBut the problem is, around that beautiful core, the React community has built a mass of libraries, meta-frameworks, techniques and practices that are decidedly less beautiful. This is exactly what I have found working with React for the past couple years. Once you factor in the React ecosystem, things get messy/ugly and decidedly unproductive. I'll most likely be moving on to Vuejs.
- 11235813213455 8y agoThere's a rich ecosystem, wide choice in React, definitely a benefit. Singletons? Services? that's just modules in React, in all simplicity - styles scoping: CSSinJS (many libs exist, I like react-jss) - forms: they are just simple to handle using state
- azr79 8y agoExactly my experience, when they've introduced Context API in the latest version of react (16.3?) I and was seeing all these blog posts about them on all my feeds, i looked them up and tried to understand what the fuss was all about, and when I finally understood, I was like "Ok so it's solving exactly the same problem that @Injectable Services solve, but in a way more convoluted manner)