You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In following the "Setup Stores" docs I am lead to think that I can watch Ref or ComputedRef type props of a store in a component, or use them in a computed in a component, because I am misunderstanding the comment in the docs that says "you could also just use store.doubleCount directly". It should clarify that it can only be used directly in the template.
constfooStore=useFooStore();// not validwatch(fooStore.fooBar,(newValue,oldValue)=>{console.log("foo value changed",newValue,oldValue);});// workingconstthisFooBar=computed(()=>fooStore.fooBar);watch(()=>thisFooBar,(newValue,oldValue)=>{console.log("foo value changed",newValue,oldValue);});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In following the "Setup Stores" docs I am lead to think that I can watch Ref or ComputedRef type props of a store in a component, or use them in a computed in a component, because I am misunderstanding the comment in the docs that says "you could also just use
store.doubleCount
directly". It should clarify that it can only be used directly in the template.Using Pinia 2.0.33
// in component setup function
The docs:

Beta Was this translation helpful? Give feedback.
All reactions