[Vuejs]-Vuex store initiated in mainjs but is undefined in App.vue

3👍

You haven’t imported Vuex in Main.JS:

import Vuex from 'vuex'
Vue.use(Vuex)

Learn more about installing Vuex here
EDIT: Legit everyone just stole my answer…

3👍

import Vuex from 'vuex';

Vue.use(Vuex);

const store = new Vuex.Store({
    // Options
});

And just put to the Vue Instance.

Hope it helps you.

0👍

First, you need to install Vuex using npm install vuex --save

Then, import it into your store.js.

enter image description here

To understand WHEN, WHY and HOW to use Vuex, refer this URL https://dev.to/napoleon039/when-why-and-how-to-use-vuex-9fl

Leave a comment