Live data from Hacker News

Vue.js vs. React

vuejs.org

241–250 of 486 posts

Re: Vue.js vs. React

#241
post #132

We moved away from React to Vue about 8 months ago and everyone on the team is a lot happier. First reason is we hate JSX. It forces you to write loops, conditionals, etc, outside of the markup you are currently writing/reading. It's like writing shitty PHP code without templates. It also forces you to use a lot of boilerplate like bind(), Object.keys(), etc. Another problem with React is that it only really solves o…

Hm? You can actually write loops and conditionals inside of the markup. And... why would you strictly want to do that?, you can write cleaner code by separating your logic/UI. This look more like a rant overall.

Ultimately you can, but your JSX code becomes more difficult to read and write.

> you can write cleaner code by separating your logic/UI

That's precisely the point of using a templating language: separation of concerns.

JSX mixes producing markup with your component logic.

> This look more like a rant overall.

There is a difference between an opinion and a rant. I really won't debate whether Vue is superior to React, I'm just stating why I prefer it.

Re: Vue.js vs. React

#242
post #86

To me the whole idea of client-side HTML templates seems bad. They start out easy enough, but then they either limit you in power or introduce new and weird concepts to replace things that are easy, familiar and often better designed in the host language. Here is an example on which I'd love to be proven wrong: https://jsfiddle.net/j2sxgat2/2/ Its a generic spinner component that waits on a promise then passes off th…

Here is an example of that code implemented in Vue. https://codepen.io/Kradek/pen/JyLPaL?editors=1010 I really haven't run into anything I could do in React that I couldn't do in Vue. What I mainly miss in Vue is react-native.

Great, here are my thoughts on it

1. Render methods make vue basically the same as React plus MobX, right? (and afaik you can use JSX too)

2. The spinner component was registered in the global scope. Will normal build tools know about the file and properly include it, or an import will need to be placed somewhere for that to work? What happens if another module registers a "spinner" component? ES6 and CommonJS modules have already solved this elegantly, and I believe its a must for larger scale applications that may consist of multiple complex modules

3. I see many wheels being reinvented, and as a non-vue user I have no idea what they mean. For example, does `` name the first argument passed to the function? Is `default` the name of the first unnamed template? And this page is utterly baffling: https://vuejs.org/v2/guide/components.html#Scoped-Slots as I cannot figure out which thing is the template that is being passed arguments and which is doing the passing (and how).

edit: re (3) I finally got it, a `template`'s `scope` gives the props passed to a `slot` a name.

It seems to me that templates look like less learning initially, but they end up being more...

Re: Vue.js vs. React

#243

Earlier quoted context omitted.

> - Streaming server side rendering This feature appeared in React v16 (which is still in beta). Vue had it long before.

I wasn't aware VueJS had streaming server rendering (and I still can't find anything about it), but React has had it long before v16 via a library ( https://github.com/aickin/react-dom-stream )

yea, Vue had it in its core along time ago. Hence another downfall of react... you end up downloading tons of 3rd party packages that Vue gives you by default.

Re: Vue.js vs. React

#244
post #221

Earlier quoted context omitted.

And you think that's easier to read and write compared to any templating language of the last 15 years? Btw you missed :

It's slightly less easy to read than ... But it means you don't have to learn a library's HTML API. Or when you want to loop through myList, but exclude a few particular items... you know how to write that in JS, but have no idea what to do in the mark up language. You could create a filteredList, but it's often not ideal

> Or when you want to loop through myList, but exclude a few particular items

Easy, just create a computed property in Vue.

Re: Vue.js vs. React

#245

Elm is also promising: http://www.oreilly.com/web-platform/free/files/why-elm.pdf

I'm using react and like its functional approaches. I started implementing libraries such as immutablejs, recompose and ramda. I also make use of pure functional components exclusively. Then I had a look at Elm and I realized that, with all the libraries I have put together, I created my own crippled frankenstein'ish version of Elm. I think I really should give Elm a try!

Agree that Elm is a good all-in-one solution for SPAs.

You should also give ClojureScript with the simple React-wrapper Reagent a spin. All the functional stuff is built into the language, like Elm, albeit without the types, which both has its pros and cons.

Re: Vue.js vs. React

#247
post #46

You'll see quotes in this thread like "The demand for both React and Vue.js is growing tremendously" thrown around. It's good to check out npm install stats to get an unopinionated comparison. https://npm-stat.com/charts.html?package=react&package=vue&p... In reality, React is downloaded roughly 4-5x more than angular and 7-8x more than Vue. In August so far, React has 75% market share among these three libs. Interes…

A more interesting graph would be one that includes Angular 2+: https://npm-stat.com/charts.html?package=react&package=vue&p...

Re: Vue.js vs. React

#248
post #189
post #46

You'll see quotes in this thread like "The demand for both React and Vue.js is growing tremendously" thrown around. It's good to check out npm install stats to get an unopinionated comparison. https://npm-stat.com/charts.html?package=react&package=vue&p... In reality, React is downloaded roughly 4-5x more than angular and 7-8x more than Vue. In August so far, React has 75% market share among these three libs. Interes…

Another chart worth viewing: https://www.hntrends.com/2017/july.html?compare1=React&compa... Hiring is a lagging indicator, but I see React hitting a plateau the way angular did. I see Vue is on the cusp of takeoff. Time will tell if it fails to launch, but I'm seeing more interest in Vue at meetups than React. I think a lot of this has more to do with React's state management than licensing. One of the react develop…

> Everyone stopped saying React is fun after Redux.

From my understanding managing state is a fundamentally hard problem, and Redux just make it very explicit and avoid the confusion of a state living in multiple places.

Did not try Vue but is the state management simpler?

Re: Vue.js vs. React

#249
post #201
post #128

Earlier quoted context omitted.

Personally I prefer the ternary operator in those cases, however I think do expressions will fix most of the if/else awkward stuff: https://babeljs.io/docs/plugins/transform-do-expressions/

Can that actually help react look better here? I'm currently imagining: { do { if (condition_expression) { template_evaluation } }}

For a single expression some of it can be omitted:

  { do { if (condition_expression) template_evaluation }}
But I gues thats not really better.

I'm hoping jsx will eventually default to `do` expressions though, and then it becomes

  { if (conditional_expression) template_evaluation }

Re: Vue.js vs. React

#250

i sense there may be a flood of react devs switching to vuejs. once their react projects are finished. honestly react devs are missing out on how great the vue experience is. it didnt take me too long to see how much better vue is.

I would say that experience-defining tools are webpack-dev-server with hot reload, ability to use modern ES features and type definitions via TypeScript or Babel+Flow. These are available for both Vue and React. Is there something on top of that available for Vue?

https://nuxtjs.org/. here you get all of that out of the box
Post reply on HN