Open CodyBontecou opened 2 years ago
just wondering why there is an ID of ”filter-store“ but it is never used
just wondering why there is an ID of ”filter-store“ but it is never used
Hey @ddddeano.
The defineStore
function requires an id
parameter. In their docs, they implicitly add it like so:
export const useStore = defineStore('main', {
// other options...
})
But I prefer to be more explicit.
Pinia states in their docs This name, also referred as id, is necessary and is used by Pinia to connect the store to the devtools.
.
So it sounds like this id
is how they manage the UX within the devtools. You can read more about it in their docs if you're curious.
Hi Buddy, first of all, thanks for your article. I am just wondering, can I use Nuxt State (https://v3.nuxtjs.org/docs/usage/state/) instead of Pinia? I see it has similar features (like sharing data across components).
Hi Buddy, first of all, thanks for your article. I am just wondering, can I use Nuxt State (https://v3.nuxtjs.org/docs/usage/state/) instead of Pinia? I see it has similar features (like sharing data across components).
Hey hey. Glad you enjoyed the article. As for useState, I'll dig in a bit more and let you know what I find!
How to use pinia within the API?
https://codybontecou.com/nuxt3-and-pinia.html