Live data from Hacker News

Vue.js vs. React

vuejs.org

231–240 of 486 posts

Re: Vue.js vs. React

#231
post #221

Earlier quoted context omitted.

> It forces you to write loops, conditionals, etc, outside of the markup you are currently writing/reading. I don't get this complaint at all. Between map and ternary expressions, you can get both loops and conditionals in your markup, e.g. {listOfThings.map(thing => thing.isX ? )}

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

Re: Vue.js vs. React

#232
post #203
post #191

Earlier quoted context omitted.

It means that you can't loop where you actually need that loop and that makes reading and writing markup harder than it needs to be. https://facebook.github.io/react/docs/lists-and-keys.html Since JSX mixes logic and markup indistinguishably I'd say that's where the poor separation of concerns really is.

I'm not sure I follow. To use the basic example from the link, as opposed to this: const listItems = numbers.map((number) => {number} ); return ( {listItems} ); What's wrong with looping this way?: return ( {numbers.map((num, i) => {num} )} )

> What's wrong with looping this way?

The problem IMO is that it's harder to read and write than:

    	
        {{num}}
    
That's Vue's syntax, but any other templating language is more readable to me than JSX.

Re: Vue.js vs. React

#233
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…

npm stats are slightly deceptive because Vue is huge in China. In China npm is very slow so most devs use mirrors to download their packages. so the * here is npm doesnt really include China, which is arguably Vue's biggest market.

Re: Vue.js vs. React

#234

MithrilJS

Oh if only mentioning mithrils name would be enough to explain it's benefit I think a lot more people would be using it, but we need to do a bit better than that. Mithril is one of the few libraries that really embraces JavaScript and the beauty of a clean abstraction and lean API. There's no heavy learning curve, just learn a couple of method signatures, and you're ready to go. Once you need to do something advanced…

I left mithril for domvm. It has a smaller focus and less magic.

https://github.com/leeoniya/domvm

Re: Vue.js vs. React

#235

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 )

Apparently my google-fu was failing me. Found the docs on streaming rendering for Vue here:

https://ssr.vuejs.org/en/streaming.html

Thanks for pointing out that it has it.

Re: Vue.js vs. React

#236
post #104

Another option that is interesting right now is Polymer 2.x if you haven't tried it recently, give it a shot. https://vuejs.org/v2/guide/comparison.html#Polymer There are some similarities shared between polymer and react/vue (personally only used react and angular 1.x before). I've built applications with it using polyfills and things worked just fine with legacy applications on IE10 + jquery interacting with web co…

Having 1k components sort of seems like a bug rather than a feature. How does that avoid becoming left-pad hell again and how would you expect any sort of quality control out of that?

Re: Vue.js vs. React

#237
post #222
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…

What makes Marko better then all others in your opinion? Apart from speed which is the only thing I could gather on the Google. And why are there no interest? Because it is from Ebay? I mean look at the reply and no one even want to touch on it.

Marko is faster and lighter. Also the syntax of single file components is more minimalistic than Vue, which is a good thing.

I'd say there is no interest because the single file components are quite new, and before that the project was focused on being a really fast templating engine.

https://github.com/marko-js/templating-benchmarks

Check this presentation about Marko, I found it illuminating.

https://www.youtube.com/watch?v=i6eZA8Y_GgA

Re: Vue.js vs. React

#238
I happily used Angular 1 for a few things. When it became clear that Angular 2 was the party line, I looked at it and unfortunately found an overengineered framework chasing what React was.

I looked at React, but without a cohesive framework, that ecosystem is just a bit too much of a mess. A gazillion starter app templates that can't quite agree and always seem a little out of date with the fast moving components. JSX is just ugly. At least to me. I regularly use Django templates, so the clean leap to Handlebars-style templates feels very natural to me. Redux is straight up unapproachable to someone new to the concepts, but at the same time it feels like it simply reinvents events and event handlers.

Vue was a revelation. It is simple, cohesive and I feel productive.

Re: Vue.js vs. React

#239
post #232
post #203

Earlier quoted context omitted.

I'm not sure I follow. To use the basic example from the link, as opposed to this: const listItems = numbers.map((number) => {number} ); return ( {listItems} ); What's wrong with looping this way?: return ( {numbers.map((num, i) => {num} )} )

> What's wrong with looping this way? The problem IMO is that it's harder to read and write than: {{num}} That's Vue's syntax, but any other templating language is more readable to me than JSX.

I find the JSX loop infinitely easier to understand what's going on. It's a javascript map. With your Vue example, what is listItem? An array? Can it be an object? Does listItem need a special decorator for v-for to be able to loop through it?

So many initial questions that just aren't there if you just use Javascript.

Re: Vue.js vs. React

#240
I'm currently investigating Vue to see how it compares to the current React code I have. So far I'm liking it.

The main things that I like so far;

* Single file components - I actually really like this, I find it much easier on my brain to have everything related to a component in the same file.

* The router and data modules - having the router and Vuex as "official" parts of the ecosystem (as opposed to in React where they are "adopted") means that everything just clicks.

* Styling - when I first started out with React, it was a pain to find a nice way to do CSS - do you use modules? Just have files that you import? Inline? Having it automatically scope the styling to the component if wanted, or using modules if thats your thing - is so much nicer than having to think about it. I just add and I don't have to worry.

The only downside I have at the moment, is having to learn the "v-" bindings (which is what put me off Angular when it first came out) but I think that it is something I can live with. Although you can use JSX and have a render method so I might try that and see how that flows for me.

Post reply on HN