I'm currently learning Vuex and reading this part of the official Vue documentation. I was wondering if there's a particular reason why we would access state with argument instead of just using this? I tested if things will work with this which it did.
Vue Example
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++;
}
}
})