2 ms·
TL;DR - good article, just a couple of thoughts/questions. Interesting. So is this syntax: new Vue({ el: '#app', ... }); required for every eleme
by dvdhnt 10y ago
TL;DR - good article, just a couple of thoughts/questions.
Interesting. So is this syntax:
new Vue({
el: '#app',
...
});
required for every element or component in the same way that this is?
class App extends React.Component { ... }
Or is more the equivalent of ReactDOM.render? i/e
ReactDOM.render(App, document.getElementById('app'))
Additionally, going through some Vue examples, I see this usage:
var app = new Vue({ ... });
app.$mount('.my-app');
I'm going to guess that creating a new Vue app object is equivalent to something abstracted away by React once ReactDOM.render is called, and that ReactDOM.render is more like the Vue.prototype.$mount function. Is that correct?
The more I look at Vue code, the less of an issue I have with its syntax, something I initially didn't like as it reminded me too much of Backbone, but that was probably just the el: property. Without getting too far down the rabbit hole, I think the biggest concern I'd have with Vue (re: wouldn't enjoy) is going back to using v-* HTML properties like this:
<section class="main" v-show="todos.length" v-cloak>
That's something I never enjoyed with Angular.