Created
November 26, 2021 17:22
-
-
Save devmnj/200fead77484356457a272eec1ad35f9 to your computer and use it in GitHub Desktop.
Nuxt3 Pinia Store example [typescript]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { defineStore,acceptHMRUpdate } from 'pinia' | |
| export const useStore = defineStore('storeId', { | |
| // arrow function recommended for full type inference | |
| state: () => { | |
| return { | |
| // all these properties will have their type inferred automatically | |
| count: 0, | |
| } | |
| }, | |
| }) | |
| if (import.meta.hot) { | |
| import.meta.hot.accept(acceptHMRUpdate(useStore, import.meta.hot)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment