How should Pinia's store be correctly used in Vue 3 components?
Option A
const fooStore = useFooStore();
function bar() {
return fooStore.bar
}
const compProp = computed(() => fooStore.someProp)
Option B
function bar() {
return useFooStore().bar
}
const compProp = computed(() => useFooStore().someProp())
Queries:
- Is there a difference between the two ways of calling the store?
- In
Option A
, can I guarantee that the values from the store are up to date? - Could it be that
Option B
is less optimal performance-wise? - What is considered the best approach?