Live data from Hacker News

Vue.js vs. React

vuejs.org

291–300 of 486 posts

Re: Vue.js vs. React

#291

Earlier quoted context omitted.

1) @ is just a shorthand for v-on:*, like onclick,onmouseover,on submit, etc. (ie; v-on:submit is alias ed by @submit) @click="say_something('hello')" new Vue({ methods: { say_something (str) { ... } } }) 2) : is just a shorthand for v-bind (ie; v-bind:disabled="is_disabled()" is aliased by :disabled="is_disabled()"). and this basically allows you to run pure javascript code inside of it. 3) the only other syntax to…

It looks way more complicated then jsx. Why invent v-if etc when JavaScript has those built in.

1) separation of html and js

2) shorter to write and simpler to read

Re: Vue.js vs. React

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

I can vouch for SvelteJS. It's simple & has near vanillaJS performance.

I use SvelteJS on both the client & server side. SvelteJS also has a rehydrate feature, which allows you to render html on the server & then bind the Component on the client.

Re: Vue.js vs. React

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

> 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. here here! This has been my experience as well

In my experience, the folks that feel the strongest against JSX lean anti-JavaScript in general. JSX is Turing-complete. There are no gotchas, you can't paint yourself into a corner, you can set breakpoints in your map statements, it's more testable...Lots of benefits and a big step up over string-based templating languages stuffed into HTML.

Re: Vue.js vs. React

#294
In a way VueJS is "React for those who liked Angular1".

I've done many Angular apps. I've done a bit of React (with Reflux & Browserify).

I tried moving to React/Redux/Webpack but it's not an easy task to grasp the whole thing. Webpack itself was close to make me throw the towel on side projects.

I tried VueJS because of a job interview and quite liked it and got productive really fast thanks to good documentation and my previous experience in angular & React.

Professionally I wouldn't mind any of those but for side projects it will be VueJS from now on.

As a side note I don't get why all the boilerplates always mix backend and frontend code and dependencies. If you're not interested in a node backend and learning it's overwhelming.

The worst thing is that boilerplates you find are always outdated (router, hot-reloading etc) and worst of all mingling server and client deps so if you're not interested in a node backend you have to

Re: Vue.js vs. React

#295
post #254
post #232

Earlier quoted context omitted.

> 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.

How is that more readable? Furthermore, does that break at runtime if listItem is undefined or you typo'd the second num? JSX would catch it as a syntax error.

Do you need the whole text of an error or answer "yes" will satisfy you ? :)

Re: Vue.js vs. React

#296
Vue feels like a framework written by AngularJs developers. It's not "better React", it's more like better angularjs.

Html templates are a major turn off for me there, and using JSX is not optimal.

Re: Vue.js vs. React

#297
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.

Templates have always been nice for basic examples. But now what happens if you only want to show odd numbers in listItem? It's not obviously clear how to do that in this example. Then you start adding in filters or Angular pipes. And the syntax grows in complexity until it becomes unwieldy. If you know the basic rules of JS, you already know how to achieve this with JSX. There's no need to go read the docs.

Re: Vue.js vs. React

#298

Earlier quoted context omitted.

It looks way more complicated then jsx. Why invent v-if etc when JavaScript has those built in.

1) separation of html and js 2) shorter to write and simpler to read

1) v-if is not html. In html if you see you immediately think, "there's a level-3 header element here". The thought "there's a level-3 header element here if..." is something new you have to learn for Vue.

2) Shorter is not always easier. For example, using quotes to delimit logical expressions makes it easy to make errors. See the misplaced quote here?

  hello super user {{name}}

Re: Vue.js vs. React

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

I can vouch for SvelteJS. It's simple & has near vanillaJS performance. I use SvelteJS on both the client & server side. SvelteJS also has a rehydrate feature, which allows you to render html on the server & then bind the Component on the client.

There will be talks about SSR with web components on https://summit.polymer-project.org/speakers. There is talk by author of SkateJS.

Re: Vue.js vs. React

#300
post #57
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…

Something worth noting is that both Angular and Vue are far more script-embed-directly-into-page friendly (mostly due to templating) compared to React. Almost all React users get it from NPM, while I would expect that the proportion of Angular or Vue users who get them from NPM is lower. I've seen a lot of projects for those two run without any build system (and anecdotally, I'm pretty sure I'm not the only one who's…

Angular 1 is, but Angular 2+ is not at all. Angular's CLI is Webpack based, and leverages NPM for package management.

As for build systems vs. script includes... I think Vue is probably being used in a lot more hobby projects than npm downloads would seem to indicate...but using a build system is a stronger indicator of a professional web app and pretty much necessary for any non-trivial project.

Post reply on HN