
Ask HN: Which is best React or Angular? - antoaravinth
Hi HN,<p>We are going to migrate our vanilla js application to either React or Angular world. Given that our application is an CRUD based application, we need to know which one is good&#x2F;best.<p>I know React is not &quot;MVC&quot; pattern in itself, but with Flux it is comparable to Angular ( correct me if I&#x27;m wrong here). I have seen Angular 2 is coming up which is going to remove the existing feature that are in Angular 1.x versions. So we fear whether angular is right choice &quot;now&quot; for us! Because our UI is already an complex, we don&#x27;t want to change our code-base when Angular 2 comes up. We don&#x27;t want to do that at all.<p>And interestingly we yet to &quot;learn&quot; Angular &#x2F; React given the choice; So learning curve also going to be an matter for us.<p>Given these facts, which framework HN will be suggesting for us and why?<p>Thanks a lot for all your reply.
======
Mimu
I only work with angular but I wouldn't recommend to chose Angular for any new
projects, especially if you have no knowledge in it.

It is already "dead". Of course the existing projects will remain, but create
one on a framework you know will not evolve ever again soon doesn't sound like
a right move.

Granted given the speed of change in front end whatever you chose will
probably disappear in a few years. :/

~~~
antoaravinth
Thanks for your response. So Angular 2 going to break almost everything in
angular 1.x versions?

~~~
Mimu
Unless it changed, you have to think about Angular 2 as a complete new
framework that has nothing to do with Angular 1. It sounds like it's just an
update but it will really be 2 different thing (just like angular with react
or ember, now you can add angular 2 as a new one), I don't know why they kept
the name.

~~~
antoaravinth
Thanks for your insights.

------
hex13
"We are going to migrate our vanilla js application to either React or Angular
world"

Does "to migrate" mean "gradually refactor and gradually pack code in
React/Angular components". Or does it mean "to rewrite from scratch"?

How big is the application?

Does it have clear architecture and clean code or is it big ball of mud with
ugly looking code?

~~~
antoaravinth
It means "gradually refactor and gradually pack code in React/Angular
components".

>> How big is the application? Yeah its pretty big. Has at least 7-8 different
pages and workflows.

>>Does it have clear architecture and clean code or is it big ball of mud with
ugly looking code?

The code is in "somewhat" good state. Few components we have followed MVC
using vanilla js; where as few components still remain the same ( as ugly
looking code )

------
kentor
React makes you a better javascript developer, no doubt. The problem I have
with other frameworks (Angular, Ember) is that they use a templating language,
instead of Just Javascript™. After using React, I never want to touch a
templating language ever again. I don't want to learn a DSL to do simple
things like loops + filters and conditionals, which I already know with
Javascript. I don't want to learn their special scoping rules, something which
Javascript has already defined. And I seriously doubt debugging templates is
easy.

~~~
antoaravinth
@kentor: Looks like learning React is far more easier. But learning Flux looks
a bit involved process. Not great samples and books available out there. Any
idea, where to get started?

~~~
kentor
I would recommend Redux for data management. I've been using that at work and
it's been great. Their docs are also pretty good.

Maybe a good place to start is with one of those boilerplate repos that have
React + build tools already set up: [https://github.com/gaearon/react-
transform-boilerplate..](https://github.com/gaearon/react-transform-
boilerplate..). Then you just add the stack that you want, like redux and
react-redux with npm install.

~~~
antoaravinth
Redux looks stunning. Thanks a lot for suggesting it.

------
kmg
Though I don't have experience with a large rewrite like this. I am really
liking what I see in React.

React + Redux for the Flux pattern seems to be the best combination available
right now. Watch this talk by Jessica Kerr - Functional Principles In React
[https://www.youtube.com/watch?v=1uRC3hmKQnM](https://www.youtube.com/watch?v=1uRC3hmKQnM)
about why Functional / Declarative approach is good for front end development.
Also Dan Abramov (Redux Author) Talk - Live React: Hot Reloading with Time
Travel
[https://www.youtube.com/watch?v=xsSnOQynTHs](https://www.youtube.com/watch?v=xsSnOQynTHs)
introducing Redux is great.

Watch this awesome talk by Ryan Florence - Don't Rewrite, React!
[https://www.youtube.com/watch?v=BF58ZJ1ZQxY](https://www.youtube.com/watch?v=BF58ZJ1ZQxY)
on how to approach rewrites bottom up and he rewrites a part of the TodoMVC
written in Backbone.js.

~~~
antoaravinth
Thanks for your insights. Looks like Redux is far more easier than other flux
implementation out there. Is redux is mature enough to be used?

------
debacle
I don't think there's a single right answer to choosing a framework/library
for JS development, except that Angular is not the right answer.

~~~
antoaravinth
So your saying angular is not the right answer from the perspective of Angular
2 or from your experience in Angular?

~~~
debacle
Both.

~~~
antoaravinth
Since you said 'both', can you elaborate on another point ( apart from the
fact angular 2 gonna change angular 1 versions )? That might be helpful for
us.

~~~
debacle
It's very hard to do things 90% Angular. Integrating Angular functionality
with JavaScript is difficult.

~~~
antoaravinth
Interesting to see that 90% of angular is tough! Thanks for your thoughts.

~~~
debacle
Not quite what I meant.

If you do 100% of your UI in Angular, you will be fine, but as you use more
custom JS in the UI, it becomes more and more difficult to manage the
separation if Angular and the UI.

------
poof131
I would say it depends on if your app is more consumery (react) or enterprisey
(angular).

React will give you better performance and server side rendering. It mixes the
view in the javascript which can be a little off to some.

Angular will give you a larger framework with two way data binding and likely
faster dev cycles. There is a roadmap to 2, but until then no server side
rendering and issues with performance if you aren’t careful.

~~~
antoaravinth
Thanks for your input. One quick question, learning curve for angular and
react will be?

~~~
hex13
Angular - Hello World is super easy but as you go deeper in Angular you become
overhelmed by its complexity (mostly accidental) and limited by it. You will
constantly think "how do I do this in Angular way" and after searching Stack
Overflow you often end up doing some creative hacks to overcome Angular
limitations. And debugging in Angular is hard, even error messages are super
cryptic.

React - Hello World is also super easy but it's good to know about ES6,
Gulp/Grunt and Babel (it's not necessary though. You will have just more
syntax sugar). As you go deeper in React you’ll have to get familiar with
recommended architecture and principles for React (flux architecture,
unidirectional data flow, immutability etc.) and because React is only
view/rendering part, you probably will be wiring React with something else
(e.g. Redux or other library for keeping state and dispatch actions).

In other words: using Angular you'll have to deal with complexity of framework
API but app architecture will be determined and forced by Angular. So probably
you don't have to be good at programming to do Angular.

Using React you’ll have to understand its architecture and
functional(immutable/without side effects) programming, but API itself is
super simple. And there are super helpful error messages if you mess up
something.

~~~
antoaravinth
Thats an very good comparison. Thanks for it!

------
jurgenwerk
Take a look at Ember.js. Seriously. Performance is now on par with React (I
think the core developers are secretly in love with React and try to bring all
good ideas into Ember). By using it you get the whole front-end package by
default (ES6 (modules!), CSS preprocessor, promise based data store, awesome
debugging tools, generators, everything perfect out of the box. It follows
conventions so every Ember app is structured in the same way. Upgrade cycles
are a breeze and they follow SemVer.

~~~
antoaravinth
So your suggesting, Ember has almost all React's feature? And almost same
performance?

Guess the learning curve of Ember is also easy.

~~~
jurgenwerk
Basic ideas yeah, like dom diffing and unidirectional, immutable data flow.
I'm also sure the learning curve is far nicer than it used to be back in the
old days when it was an immature framework.

------
marknutter
I hope you haven't made your decision yet because the comments in this thread
are extremely misleading.

First of all, please remember that _nothing_ is faster than a properly written
vanilla js application. Every layer of abstraction you add will necessarily
slow your app down. You gain convenience at the cost of performance.

So unless you're dealing with major issues in terms of complexity and
understandability, I would ask yourself why you need to have a shiny new
framework in the first place?

But let's assume you do. You're in the same boat that a lot of companies and
developers are in these days - what the hell framework do I choose when a new
one seems to pop up every day? Spoiler: there's no right answer. I assume you
want your app to be future proof, which is a fools errand, but supposing
you're a fool like the rest of us then my humble advice to you would be to
read up on web components and choose the framework that embraces them the
best.

That would narrow your choices down to Angular 2, Polymer, Aurelia, and
probably some other less mainstream frameworks I haven't heard about. Angular
2 would be a fine choice but it's going to be a pretty radical shift to the
way people do things, but it will come with a reward of up to 10-15 times the
performance of angular 1.+ and react. Oh, and it's not ready yet.

Aurelia takes a lot of its queues from Angular 2 but it's basically production
ready today and far simpler in terms of its complexity and API. It's all-in on
web components and has a very enthusiastic and helpful community surrounding
it.

Polymer is Google's _big_ bet on the future of web development. It's at 1.1
and production ready, and will be extremely well funded for years to come.
It's basically sugar for creating web components. It's similar to React in
that they encourage you to build your application out of nested components.
It's different from React in that it embraces the web components spec and the
DOM. React has explicitly stated multiple times that they have no interest in
web components.

Polymer isn't quite as simple to get up and running with as React and Google
needs to address that, but it's getting better. But the big thing the polymer
team has going for them is that they literally share desks with the Chrome dev
team, and as such they have their finger on the pulse of cutting edge web
browser technology. The React core team doesn't have that luxury, so they've
taken the radical approach of trying to abstract away the DOM completely. It's
an intriguing approach but in my humble opinion it's hostile to the open web.
Make no mistake that Facebook is doing what's best for Facebook. Google is
doing what's best for Google, too, but that happens to align with the goals of
the open web.

Anyways, I hope you don't just jump onto the React bandwagon before giving
your research a little more time. HN is an echo-chamber and the word "React"
is just the latest echo you see bouncing around.

------
tallerholler
ember/ember-cli...

