After adding Vuex to my project I am unable to access this.$store in any components. The error message is
TypeError: _this.$store is undefined
SOLVED:
Using fat arrow on created is not correct, should be created: function() {...}
When arrow functions are used "this" will not be the Vue instance as you’d expect since arrow functions are bound to the parent context. Instead,
created() { //function body. "this" will be the Vue instance},
mounted() {//function body. "this" will be the Vue instance},
methods: { someFunc() {}, async someAsyncFunc {} }
I also encountered this problem after moving the store from app.js to /store/index.js
I had to change state.store.myValue
to store.myValue
in the commits