0👍
You should install vuex 4 which it’s compatible with vue 3 using the following command :
npm i vuex@next
then create your store as follows :
import { createApp } from "vue";
import App from "./App.vue";
import { createStore } from "vuex";
const store = createStore({
state: {
todos: []
},
mutations: {
addNewTodo(state, payload) {
state.todos.push(payload);
}
},
actions: {},
getters: {
getTodos(state) {
return state.todos;
}
}
});
let app = createApp(App);
app.use(store);
app.mount("#app");
- [Vuejs]-Vue: data is not binding to props therefore not rendering BarChart using vue-D3-charts
- [Vuejs]-Vue cli axios mixing array indexes when getting requests
Source:stackexchange.com