I have been trying to resolve the issue with
(0 , pinia__WEBPACK_IMPORTED_MODULE_1__.useStore) is not a function
but unfortunately, I haven't been able to find a solution. Can anyone point out what mistake I am making?
Here is my store.js code:
import { defineStore } from "pinia";
export const myStore = defineStore("myStore", {
state: () => ({
count: 0,
message: "Hello, Pinia!",
}),
actions: {
increment() {
this.count++;
},
updateMessage(newMessage) {
this.message = newMessage;
},
},
});
And here is my App.vue code:
<template>
<div>
<p>Count: {{ store.count }}</p>
<button @click="store.increment">Increment</button>
</div>
</template>
<script>
import { defineComponent } from "vue";
import { useStore } from "pinia";
export default defineComponent({
setup() {
const store = useStore("myStore");
return {
store,
};
},
});
</script>