Currently delving into Vuex and studying this section of the official Vue documentation. I'm curious as to why one would access state
with an argument instead of simply using this
? I experimented with using this
and found that it still worked.
Vue Sample
const store = new Vuex.Store({
state: {
count: 1
},
mutations: {
increment (state) {
state.count++
}
}
})
My Example
const store = new Vuex.Store({
state: {
count: 1
},
mutations: {
increment () {
this.count++;
}
}
})