CodyBontecou / blog

http://codybontecou.com/
12 stars 25 forks source link

[Vssue]Nuxt 3 and Pinia #23

Open CodyBontecou opened 2 years ago

CodyBontecou commented 2 years ago

https://codybontecou.com/nuxt3-and-pinia.html

ddddeano commented 2 years ago

just wondering why there is an ID of ”filter-store“ but it is never used

CodyBontecou commented 2 years ago

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.

lucasctd commented 2 years ago

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).

CodyBontecou commented 2 years ago

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!

phillipmohr commented 2 years ago

How to use pinia within the API?