News for hackers. Stuff that matters.
Re:Why Choose Vue.js by ElatedOwl on Friday June 23, 2017 @04:07PM (#14622327)
In a larger Vue application you would use a data store (ie Vuex). The only thing that can mutate the data are "mutation" methods in the data store. It is your single source of truth.

If you aren't using a data store, your parent component would solely be responsible for mutating data. If the child component needed to alter it, it would raise an event that the parent would listen to and make whatever modifications necessary.

I'm having a lot of trouble truthfully understanding your "mental back-and-forth" issue and I'm wondering if it's an inexperience with Vue issue. Give it a try... I'm willing to bet you'll love it.

Re:Why Choose Vue.js by ng12 on Friday June 23, 2017 @04:52PM (#14622684)
Maybe using "source of truth" was bad phrasing, the question is about rendering data not the data itself. I am convinced templates are a fundamentally broken technology. In React there's only one place things happen: in the JSX. This is not true for Vue -- you have at least two discrete objects (the template and the view) communicating back and forth.
Re:Why Choose Vue.js by ElatedOwl on Friday June 23, 2017 @05:38PM (#14622998)
Have you seen Vue's single file components?

It's a (single file), which would look something like (idk how to format code on h/n lol):

<template> <ul> <li v-for="message in messages">{{ message }}</li> </ul> </template>

<script> export default { data () { return { messages: ['hello', 'world'] } } } </script>

I realize this is a completely trivial example, but is this what you're getting at? Everything related to that component is in a single place. The template itself handles any UI specific logic: conditionally showing an element, looping, binding an event.

Any real logic is going to be handled from the component itself.

That said, Vue actually supports using a render function as opposed to using a template. You can even use JSX if you want (though I certainly wouldn't consider JSX a first class citizen in Vue).

Re:Why Choose Vue.js by ng12 on Friday June 23, 2017 @06:18PM (#14623196)
But do you see the inter-dependencies between the script and the template? The template is assuming that it's provided a variable named messages and that it's an array of ready-to-display strings. And this information is stringly typed -- will your editor complain if you fail to define messages? Can I use Typescript to ensure that each message is what I expect? Sure, it's easy enough for simple examples but I've seen it fall apart quickly for large projects with multiple developers.
Re:Why Choose Vue.js by true_religion on Friday June 23, 2017 @06:35PM (#14623277)
I'm not seeing the issue here.

This kind of system is extremely common on the backend---Python's Django and Ruby on Rails, to name a few frameworks follow the practice of templates being given data and simply acting upon it.

Since these are dynamically typed languages, there's no IDE typing support in the template.

There's just testing.

As someone who uses Django regularly, I can say there's a huge swatch of territory between "small examples" and "large projects".

That territory can easily cover teams of 19, and multimillion dollar projects.

Re:Why Choose Vue.js by ng12 on Friday June 23, 2017 @06:54PM (#14623363)
Right, it's a common technology and it's always been a pain. With React everything is well-defined and typesafe (either through PropTypes, Typescript, or Flow) and the IDE support is fantastic.

That's my whole contention -- Vue is just a better iteration of the same old painful experience. React actually solves the problems I have.

Re:Why Choose Vue.js by amcca029 on Friday June 23, 2017 @05:41PM (#14623012)
the templates rendered. There is a singular state, because data flow is one directional. mutating properties is an anti-pattern in vue.
Re:Why Choose Vue.js by dabernathy89 on Friday June 23, 2017 @04:21PM (#14622431)
My guess is that they started looking at Vue before v2.