Working Vuex - Suggestion??
aaronksaunders opened this issue · 1 comments
aaronksaunders commented
First off... looks great!!
In the example you are using mapActions, but not mapState
message () {
return `Counter: ${this.$store.state.counter.count}`;
},
surprise () {
return (this.$store.state.counter.count >= 5);
},
vs
...mapState({
message: state => `Counter: ${state.counter.count}`,
surprise: state => state.counter.count >= 5
})
also I noticed that we need to actually inject the store into the Vue object, which doesn't appear to be necessary in normal vuejs so you might want to highlight what is happening there and why
Vue.prototype.$store = store;
tecnoloco commented
In nativescript-vue/nativescript-vue#46 @rigor789 said that the work around of Vue.prototype.$store was not necesary anymore but acturally it is necesary as for now (v1.3.1 -latest release-).