Vuex Store accessing state with 'this' Vuex Store accessing state with 'this' vue.js vue.js

Vuex Store accessing state with 'this'


The Vuex store instance is not an ordinary object that has its own this, it could be seen as black box that offers some input/output for that it passes the state as parameter and then inside its logic (pattern) updates the state according to your mutation, for this available here:

 mutations: {    increment () {      this.count++;    }  }

it refers to the global window object.

According to @Spinx comments this refers to vuex instance in version 3 and later and i find that what @Matt said is a good note :

IMO this is a great example of why you should use the explicit parameter since you don't know how your function is bound __Matt