Could you explain a little about how the Pinia integration works?
In the module.ts you state
// Pinia store modules are auto imported
How are they setup to auto import? Is it because useBlogStore is being imported in the blob/[id] component?
Is it possible to use Pinia without a component in the module to store data eg: logged in user data and access it from components in the main app that is importing the module?
So basically Pinia works in all places no matter where you import it in your application. If you import it in the module, this value will be then accessible from somewhere else. It is done because Pinia is a store that can be accessible from anywhere in the app.
Yes, it is possible to use Pinia without a component. It can be used in the composables as well or page. I just showed it as an example of usage :)
Excellent thank you! I did dive deep into their docs and came to this conclusion. I essentially import the stores in my plugin.ts file inside defineNuxtPlugin with const auth = useAuthStore(nuxtApp.$pinia)
This adds the store globally and then it is accessible anywhere in the app.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Could you explain a little about how the Pinia integration works?
In the module.ts you state
// Pinia store modules are auto imported
How are they setup to auto import? Is it because useBlogStore is being imported in the blob/[id] component?
Is it possible to use Pinia without a component in the module to store data eg: logged in user data and access it from components in the main app that is importing the module?
So basically Pinia works in all places no matter where you import it in your application. If you import it in the module, this value will be then accessible from somewhere else. It is done because Pinia is a store that can be accessible from anywhere in the app.
Yes, it is possible to use Pinia without a component. It can be used in the composables as well or page. I just showed it as an example of usage :)
Excellent thank you! I did dive deep into their docs and came to this conclusion. I essentially import the stores in my plugin.ts file inside defineNuxtPlugin with const auth = useAuthStore(nuxtApp.$pinia)
This adds the store globally and then it is accessible anywhere in the app.