I believe Vue 3 is supposed to fix much of this, but its unclear whether its going to be backwards compatible.
I believe Vue 3 is supposed to fix much of this, but its unclear whether its going to be backwards compatible.
Also worth noting its not 100% true you can't manage your data separately you just need to manage the reactivity yourself.
Also, implementing your own reactivity is very unintuitive. You need to implement your own “diffing” (is this change worth rendering) to know when to force Vue to render. This is definitely not how Vue was intended to be used.
E.g: redux uses a react provider to inject the data into the component tree because of this. Vuex does the same for vue.
React will simply render the object you give it. That means that React doesn’t need to know when data changes, it simply renders the ui, diffs it to the current ui and applys the changes.
Unless your using component state but even then, it’s the rendering that measures change. The act of updating the state just lets React know “time to see if anything important changed”. Vue seems to tra Co data changes granularly which means it needs to understand the change at the point if mutation. This means it needs control of the data you want to render.
I find the limitation to only use dumb pojos much worse. AFAIK that is going to be fixed in Vue 3 since the reactivity system will use Proxy instead of getters and setters.
let external = {foo: {bar: 'something'};
new Vue({
data: function() {
return {
ref: external.foo.bar
};
}
})
external.foo = {bar: 'something else'};One big issue for me has been that your data layer needs to know about and use Vue, which seems unintuitive as Vue is a UI library.
In all honesty, the pitfalls are not that many, easy to understand, learn and avoid or get out from.
I spent way more time trying to figure out doing even basic things in react than debugging reactivity in vue. Espacially since the later has a fantastic doc and a small api.