3 ms·
Thanks for the clarification but I'm still a little confused. >VueJS keeps two way data-binding between the template and the component In what sense? If you n
by ElatedOwl 9y ago
Thanks for the clarification but I'm still a little confused.
>VueJS keeps two way data-binding between the template and the component
In what sense? If you need to update your data on the JS side from the DOM you have to use events. There's v-model, but this is just syntax sugar for binding an event on input to update the value prop.
- luord 9y ago> In what sense? If you need to update your data on the JS side from the DOM you have to use events. There's v-model, but this is just syntax sugar for binding an event on input to update the value prop. Which is why calling two-way data binding in js a "bug" is so weird (for lack of a better word). In angular, two-way data binding is, ultimately, also syntactic sugar over DOM events. For that matter, everything every frontend framework provides is syntactic sugar over vanilla javascript.
- ElatedOwl 9y agoAll I'm saying is that Vue doesn't do two way binding. v-model translates directly into a DOM event, ie <input v-model="someProp"> is equivalent to <input v-bind:value="someProp" v-on:input="someProp = $event.target.value"> Which, as far as I understand, is exactly how React handles it and is deemed one way binding. ¯\_(ツ)_/¯
- luord 9y agoWe seem to be about to start going in circles so I'm cutting here with one last remark: For what it's worth, in Angular one can also make the events explicit, and yet in there it is called two way binding.