
Ask HN: Did you switch from React to Vue last year due to the licensing dilemma? - tiuPapa
If you did, are you considering switching back to React? How is your experience with Vue? What does Vue do better than React? What does React do better than Vue?
======
joshribakoff
I'm switching from Vue to React because I find it really kludgy to have to
call Vue.set to declare new reactive properties at runtime.

Its also a bit nicer in that React tends to follow ES standards like ES6
classes for components, instead of exporting a POJO for your component. In vue
you often have to use function() instead of fat arrow syntax because of the
context of "this". With react you used to have lots of .bind(this)
boilerplate, but now we have shorthand property syntax. Vue also mixes props &
state, where as React keeps them separate. React implements certain lifecycle
methods like componentShouldUpdate() whereas Vue doesn't because the creator
thinks it would complicate the API, meanwhile there's known issues like
between Vue.js & HTML5 content editable due to this lack of lifecycle method.

Vue is easier to get going & much faster to develop in initially, lower
learning curve, and friendlier API.

~~~
CaveTech
Most of this is simply incorrect.

Declaring properties at runtime is an antipattern.

You never need to use function()

Props and state are absolutely not mixed. Props are inherited and immutable by
default.

Content editable doesn’t fit in with the vue paradigm but you can easily
abstract that section out of vuejs. If you dom is not dictated by your data,
then a render function makes little sense.

~~~
joshribakoff
> Declaring properties at runtime is an antipattern.

That's a pretty bold statement & I won't argue, but either way that's an
opinionated decision of the framework. React is less opinionated & doesn't
care what you use for your state. Vuejs is opinionated, they don't care about
working well with Redux or other state management libraries because they
already have their own, Vuex, which is pretty nice for the most part.

> Props and state are absolutely not mixed

a prop called "foo" & data/state param called "foo" are both accessed at
this.foo, its no longer obvious what would happen if I would try to mutate
this.foo. It mutates the data/state, not the prop, so now this.foo refers to
the value in the data/state, which has a different value from the prop "foo"
which can no longer be accessed at this.foo

> You never need to use function()

See this page which says "Don’t use arrow functions ":

[https://vuejs.org/v2/guide/instance.html#Data-and-
Methods](https://vuejs.org/v2/guide/instance.html#Data-and-Methods)

> you can easily abstract that section out of vuejs.

Yeah you can, by not using vuejs. React has escape hatches to get out of your
way, so you could continue to use it in that scenario thats part of why im
switching back from vuejs to react.

~~~
CaveTech
> a prop called "foo" & data/state param called "foo" are both accessed at
> this.foo, its no longer obvious what would happen if I would try to mutate
> this.foo. It mutates the data/state, not the prop, so now this.foo refers to
> the value in the data/state, which has a different value from the prop "foo"
> which can no longer be accessed at this.foo

Well yes, but have props and state with the same name is again just code
smell.

> See this page which says "Don’t use arrow functions ":

This is a very narrow restriction and pretty obvious why you shouldn't do it,
ie it passes a context that makes no sense. This is not a Vue limitation.

> React has escape hatches to get out of your way So does Vue, don't use the
> Vue `render` if Vue isn't managing the state.

~~~
joshribakoff
Hey you quoted my point about escape hatches but forgot to respond, interested
to hear your thoughts. I guess to the 1st point, yes and Vue js allows this
smell while React doesn't.

Regarding 2nd point, I disagree it's narrow, it affects all methods for all
components. But its not a big factor in deciding what framework to use.

React is just a tad more "standards compliant" when it comes to web
development, in my opinion. And in web development standards matter a lot,
even when the standards themselves may not be great...

I really like VueJS for what its worth, its still my favorite framework, but
I'd bet my money on React in the same sense I would invest in Walmart even
though its not the perfect business. The react ecosystem has a much higher
learning curve also, to play devils advocate.

~~~
CaveTech
Sorry I responded but I forgot the newline.

In either case react is clearly the better ecosystem, but vue is a really,
really solid framework itself.

We’ve hit our own limitations that we’ve had to work around, but imo most of
the points you bring up have quite simple fixes.

Cheers!

------
jackaroe78
Yes, we had been planning to switch from Angular 1.x to React but our legal
team determined it was too risky. The licensing issue was cleared up (I think)
right after that decision was made

~~~
throwaway2016a
That is really a shame. React is hugely better than Angular 1.x in just about
every way in my opinion.

When we switched productivity went through the roof and the site rendered
faster.

That's not actually why I switched though. I switched because of the whole
mess with Angular 2.x planned lacked of backwards compatibility. It was the
nail in the coffin for Angular for me.

------
CharlesMerriam2
We had to suspend React development. I think one team decided to switch from
browser based to a native app, the other team is back on React.

------
electric_sheep
Nope, our legal dept gave us the OK on the original license.

