Home » vue » Can be Vue.observable be used as Vuex replacement?

Can be Vue.observable be used as Vuex replacement?

Posted by: admin November 26, 2021 Leave a comment

Questions:

New Vue 2.6 introduce Vue.observable. I read docs, but still can’t understand if Vue.observable can be used as Vuex?

Could anybody explain me this please?

Answers:

It is just a shorthand for old: new Vue({data() { return {...}; } }).

If you need data which is shared between components you had to create new Vue(...). Now you can use observable – Vue.observable({...}) and use it in render-functions or computeds.

So, I think it is not Vuex replacement, because Vuex cares about global App data and has nice debug tools.