How can I use other getter inside setup store in Pinia?
export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const name = ref('Eduardo')
const doubleCount = computed(() => count.value * 2)
const HOW_TO_USE = computed(() => { /* how to use doubleCount here? */ } )
function increment() {
count.value++
}
return { count, name, doubleCount, increment }
})
Edit - follow-up
If I want to pass an argument to that HOW_TO_USE , then should it be just returning a function like this?
const HOW_TO_USE = computed((arg)=> /* do with arg */)
or actually this:
const HOW_TO_USE = (arg) => computed((/*no args*/)=> /* do with arg */)