14 ms·
As someone who uses Angular 1 currently but would pick React for their next project, I'd love to see a list of reasons why I should use Angular 2 over React. I
by gkoberger 10y ago
As someone who uses Angular 1 currently but would pick React for their next project, I'd love to see a list of reasons why I should use Angular 2 over React.
If nothing else, Angular just stranded all their developers, while React has a huge head start on mindshare/plugins/tutorials/etc.
- deleted 10y ago[deleted]
- Pfhreak 10y agoAs someone who uses React currently, this would be useful to me too.
- irrational 10y agoOr Vue.js, or Inferno, or...
- asher_ 10y agoI'm currently in the same boat. Both are similar in that they are component-oriented. There are two important factors in my mind. 1. The ecosystem (as you mentioned). React has a clear head start here, but I expect Angular2 to make some gains over time. 2. Angular2 gives you a full framework, and as they say now, a whole platform. React is smaller and you rely on a bunch of other packages to get all the extra features you need. If you want a full solution, Angular2 gives you that. This can be argued as a good thing or a bad thing. More flexibility with React, but also more things you need to figure out and make a decision about. With Angular2, once you buy in, you don't need to make all of those decisions. In my particular circumstance, which is to migrate an Angular1 app to a newer framework over time (mainly for the server side rendering features), Angular2 provides a clearer path and offers some nifty features like component styles that allow a similar migration with CSS.
- BigJono 10y agoAs someone who has never used Angular but is interested in Angular 2, can you give some examples of the framework-y things it provides that React doesn't? Redux is really the only thing I find necessary for what I've developed so far, and I'm sure Angular has it's equivalent, but what else does it have?
- Bahamut 10y agoIt gives the ability to do validation with form components, using a nice XHR abstraction, and a router - all optional. It also provides a robust DI framework and set of testing tools.
- gldalmaso 10y ago>> Angular2 gives you a full framework, and as they say now, a whole platform. So did Angular 1, and then they threw it under a bus. Now developers have to either refactor for a whole new framework or get stuck with a legacy one. Javascript ecosystem is becoming so hostile a project deprecates itself in favor of a clean rewrite and the migration path is an afterthought. Will think twice before adopting google frameworks and tools. Javascript ecosystem is in dire need of stability and trust.
- popmystack 10y ago>and then they threw it under a bus. They didn't just do this "because." There were sound technical reasons to do so. Angular made the correct decision, in my opinion, and decided to cut its losses immediately and right the wrongs within the framework.
- boubiyeah 10y agoWell... I would argue that angular 2 is not even better than angular 1 so it will probably happen again :p It's more performant, but that's about it. It's insane, java/spring like complex for no reason.
- popmystack 10y agoReally? So mobile support, change detection revamp, TypeScript, the removal of $scope, and all the routing changes are all just "meh" to you?
- Roboprog 10y agoWellllllll... I does make me want to learn React & React Mobile if I have to largely start over, anyway. Not saying ng-2 is not an improvement, just that it's a big change to take in.
- kayoone 10y agoI like the opinionated approach of NG2 over the flexibility of React because it takes a lot of decisions off of me that i am not too interested in when building a new project. I am a full stack developer leaning more towards backend in recent years and i found setting up and finding out about best practices and "what to use" for React a bit tedious, also it changes so much. The last Flux framework i used was alt.js which was popular last year but is hardly used anymore. I also really like Typescript and believe enforcing it is a good way to get general JS code quality up.
- danmaz74 10y agoRegarding the "Flux" frameworks, that's not a problem anymore - basically Redux (which improves on some of Flux's faults) has won. Its developer was hired by Facebook, so I guess it's kind of officially sanctioned now.
- subsection1h 10y agoHas everyone who switched from Redux to MobX been informed that Redux won and they should switch back?
- k__ 10y agoI didn't understand this. Isn't MobX the "classical" way of databinding everybody frowned upon for years? And now that React finally eased that pain with Flux and then Redux, they bring it back?
- boubiyeah 10y agoI don't think that many people switched to MobX to be honest. It's very similar to knockout observable and while it works, I don't think I would use that approach again. I suspect people like the familiar OO syntax of MobX. I can't think of advantages it has over plain old streams (most.js, flyd.js)
- Kiro 10y ago
- jasim 10y agoAll three frameworks are excellent at helping us build ambitious front-end applications; you simply can't go _wrong_ by picking one over the other. If a particular framework's trade-offs don't for any part of the app (performance for example), you can always write just that part in a different way (manual DOM manipulation). But to contrast all three, I'll pick the area I'm most interested in - templating. The purpose of a framework is to render a dynamic view without the programmer having to wire up every state transition with a corresponding view transition. This is done by templating content with state, mediated by the framework. And how this is done affects the entire design of the framework and apps written on them. Angular and Ember allows state and logic inside HTML. They figure out which state variables and corresponding templates go together and re-renders them automatically. The pro is that writing a modified version of HTML without too much code lets us have a dynamic app running in no time. The con is that there is a new language to study - with its own parser, control structures, scoping, and quirks. React on the other hand lets us specify templates as Javascript functions which are run whenever the state changes. The pro is that there is no new language abstraction to learn; it re-uses Javascript. External DSLs especially are in an uncanny valley - they're not full-blown languages but have enough quirks to be bothersome. Language abstractions forces a virtual machine (the language parser/interpreter) to evaluate the code, and it is an opaquely magical layer that makes it hard to see the entire stack of abstractions during day-to-day programming. It also forces a separation between our view (written in the templating language) with the rest of our code. The con of this approach is simply more code to write; the programmer has to anticipate and inform the framework of any state changes. With setState this isn't as bad a trade-off as we'd imagine. And MobX meanwhile brings an Angular like state abstraction to React - it watches over observables and automatically fires re-render. The other big difference is that React is not opinionated. It is a very much a framework alright, but it for example doesn't ship with a router, nor does it prescribe a framework for organizing the code. Ember has so far done a great job here - I often wish I could combine the Ember ethos of backwards compatibility, great documentation, and a fanatic love for the existing users of the framework, with the way React approaches templating and composing components. I haven't had the chance to look at Angular 2, but for me, Angular 1 started the front-end revolution happen, and I'm curious what they have done this time.
- mstijak 10y ago
- ckarthik17 10y agoFor big enterprise projects where there are many average developers, a full framework like Ember.js or Angular2 is practically easier to maintain.
- szines 10y agoEspecially Ember. Probably Ember is the best choice nowadays for serious project. Great documentation and very matured.
- 0xfaded 10y agoFor anyone wanting to try react in a side project, scalajs has comprehensive react compatibility and it's just awesome. Only downside is trying to hire Scala frontend devs.
- estefan 10y agoYeah I've been looking at this recently. I like autowire's ability to create typesafe APIs shared across the client and server. Very promising, but not simple to set up... http://www.lihaoyi.com/hands-on-scala-js/#Autowire http://www.lihaoyi.com/hands-on-scala-js/#Autowire
- premium-concern 10y agoYou don't need Autowite for that. That's pretty much basic functionality of Scala.js.
- estefan 10y agoReally? From reading that guide I thought that Autowire made it easier by automatically doing the serialisation/deserialisation. How does stock scala.js do that?
- deleted 10y ago[deleted]
- cutler 10y agoExtra downside is code bloat. Scala.js on its own just maybe but combined with another major framework - forget it.
- premium-concern 10y agoThe amount of code bloat is offset by optimizing a medium-sized picture.
- deleted 10y ago[deleted]
- dimgl 10y agoWhy not choose Vue.js? It's extremely simple, fast, easy to get started with, and very similar to Angular.
- WA 10y agoI like Vue.js, but there are no good UI frameworks such as Ionic that work with Vue for mobile apps.
- kim0 10y agoWeex exists (https://github.com/alibaba/weex https://github.com/alibaba/weex)
- jessegavin 10y agoI have used knockout, angular, react for a while. When I used vue.js the first time, I smiled. It made me happy.
- ausjke 10y agoI like vue.js, the only and biggest concern is that it is a single developer project, I'm deciding between react and ng2 now because of that concern, leaning towards react right now.
- rk06 10y agoEvan has added a dozen collaborators to Vue team. so it is no longer a single developer project. Yes, the majority of code is still written by Evan, due to speed required. but we know that vue is heading in right direction.
- Illniyar 10y agoAt the moment I also moved to react, but there are some obvious advantages in angular 2: 1. as others mentioned its a fuller framework, mostly akin to using react with redux (or flux etc...) and a di framework. This also means that angular 2 third party components are probably easier to integrate. 2. Reactive Expressions, which angular2 uses in many places, is a joy to work with (though they might become maintenance hell later on I think). You can use RxJs with React of course, but it's easier when your framework is based on it 3. It uses string templates - which means that some things such as dynamic templates and per user customization of html would probably be much easier to do then in React. 4. It has Ionic - which is much much faster to develop for mobile with then react-native (though obviously there are important differences). It's unlikely that an Ionic like framework for react will gain traction with react-native to compete with.
- indexerror 10y ago> It uses string templates - which means that some things such as dynamic templates and per user customization of html would probably be much easier to do then in React. The key with React is that you manipulate JS instead of HTML. In my experience, using JS to manipulate elements turns out to be easier and a much better experience than the conventional way of using templates.
- diminish 10y agoWhy JS declarative manipulation is a much better experience than using templates?
- LgWoodenBadger 10y agoBecause you have the full power of JS available to do whatever you want, however you want, to generate HTML. With a templating engine, you only have whatever the templating engine provides.
- Life_exe 10y agoReact would let you use JS-powered templates. Angular would let your use ANY (static html, JS generated, or dynamic/server generated), because its pluggable. For me, the power offered by Razor(cshtml) is too much to abondon.
- sjellis 10y agoYeah, we have Angular 1 code in production, and I would like us to get off this train. I'm going to be evaluating Vue.js and Aurelia, and will probably push for Aurelia.
- stephenhuey 10y agoWe were in the same boat back in January, and I looked at Vue and many others, but Aurelia won me over even though it was still in beta.
- jasonkester 10y agoI recently started a new front-end-heavy project and ended up just using Angular 1 instead of React. The decider for me was the amount of tooling that React needs you to have in place just to get up and running. React expects you to do your development on some flavor of Unix, and really doesn't have a sane plan for Windows, so you lose VS.NET and its huge productivity gains. And it needs tools upon tools upon tools to set up, whateverify, transpile and pack the files you write into something that can display in a browser. Again, this all seems to want to run from a Unix command line. I want to edit some HTML and Javascript, then reload the browser and see my changes. Angular isn't perfect, but at least it lets me do my thing without adding a bunch of extra hoops.
- flukus 10y agoThis mirrors my experience with react native. Not only did you have the react tools, but all the android tools. The abstraction leaked for me at the hello world stage where one dependency changed but I had no idea what our where without learning the entire stack.
- edoceo 10y agoSee RiotJS
- lacker 10y agoAnd it needs tools upon tools upon tools to set up, whateverify, transpile and pack the files you write into something that can display in a browser. I think this was true six months ago but now there is create-react-app. You might want to try it out - you won't need to whateverify your code, you just need that one tool. Also it works on Windows. https://github.com/facebookincubator/create-react-app https://github.com/facebookincubator/create-react-app I want to edit some HTML and Javascript, then reload the browser and see my changes. With create-react-app the browser will know you've made a change, and reload for you ;-)
- jasonkester 10y agonpm install -g create-react-app The fun thing watching the new world of Javascript is that overtooling is so built in to everything that nobody even realizes how many tools they're using. You can't even install this thing until you have the standard pile of javascript tooling in place. And it never occurred to them to even mention how to get said pile set up. Once set up, this still uses all the same stuff. It just removes a few steps to produce the Big Red Button you press to run it all.
- philippz 10y agoFor economical reasons. We decided between ng2, React and Vue.JS: https://docs.google.com/spreadsheets/d/1ULB2GjA3ytXAN_Sn-fEyDFq9BlKbpaS3iGG_MdhL1Cs/edit?usp=sharing https://docs.google.com/spreadsheets/d/1ULB2GjA3ytXAN_Sn-fEy... React would mean to rewrite your whole application as it has a totally different basic concept. Following the ng2 migration path you're able to migrate slowly.
- elmigranto 10y ago> React would mean to rewrite your whole application I don't see what is a problem to just drop in React into `<script>` tag and use for single part of the page, gradually refactoring stuff.
- philippz 10y agoThat would mean to live with a hybrid solution, more overhead and a bigger footprint. We currently deploy our JS base to web, Android and iOS (Cordova/Phonegap). It is and will remain one code base to be flexible and fast until we get "product/market fit" and until we have KPIs where we want them. This is cost effective but comes with the slowness of web-engine rendered apps. Therefore performance is big factor and we're optimizing for that. By switching to ng2 we have have a cost-effective and performant compromise.
- shados 10y agoat my last job we did a gradual migration from Angular 1 to React. Its similar to the path to Angular 2 really. React and Angular can live side by side... All we did was build an Angular directive that can render a react component in a subtree (that's easy), and a React component that could render an Angular directive (that's a little harder, but not that bad). With that, we could put a React component anywhere in our Angular app, and reuse Angular directives inside of React until we got around to rewriting them. That ended up quite smooth.
- tomasduda 10y agoWould you mind sharing the code for this?
- kinkdr 10y agoMaybe because Angular material components are much better than material-ui?
- Rezo 10y agoI've been very happy with the material-ui components for React. They cover every component I need, and it was trivial to integrate them into an existing app over time, no need to do a full conversion on day one. They also seem entirely React idiomatic, I've learned a lot about how to build reusable components myself from their API.
- kinkdr 10y agoI was put off by their TextField implementation. Their oversized <input> element doesn't play well with browsers, eg. the browser's auto-complete looks completely out of space.
- pferdone 10y agoThe problem with material-ui is that a lot of their components don't follow material design guidelines like their tables for example. It looks good, but it's not material. react-mdl is much closer to material, but incomplete due to missing components. Angular seems to have the best implementation so far, but I'm looking forward to material-design-lite v2
- devdoomari 10y agore:learned a lot about how to build reusable components myself from their API material-ui's tutorials are really bad examples on this. They teach you to import from specific dir path inside material-ui. (e.g. import Pen from 'material-ui/lib/pen' or whatever) Instead, they should recommend: import { Pen } from 'material-ui' since most of their exports are already in material-ui/src/index.js file (or some index.js file from package.json's main part)
- deleted 10y ago[deleted]
- pacoverdi 10y agoI lost so much time with Angular 1. I don't care how much v2 is better than v1, I'm not touching it with a ten foot pole (disclaimer: switched to React, not looking back).
- 6DM 10y agoI'm really feeling the pain right now. Convinced previous company react was better. Even built my own app in React, now I'm at a new place that is using Angular 1.5. My god, it's so painful trying to get everything working correctly with jquery plugins. The blessed route often doesn't work, even though technically it should. I'm also getting performance issues for really simple scenarios...
- Roboprog 10y agoThe only thing in ng-1 that really bit me, speed wise, was long select/option lists. I wrote a bit to load them using jQuery instead of ng-options and now I'm good.
- boubiyeah 10y agoThe thing is, angular 2 is not better. Not api wise. It's just more performant, which is cool and all, but react has a much better value proposition.