Which store properties to return #2402
-
I am transitioning to using setup stores in my project and I am confused about what the following statement in the documentation means:
What does it mean for pinia to 'pick them up as state'? More specifically I'm wondering if for some reason I have to return everything from the store, i.e. all the refs, computeds and functions for them to work correctly (trigger reactivity etc), even if they are only used internally in the store. Or do I only have to return things that I actually use outside the store? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
The latter. You don't need to return anything that you don't want to directly access outside your store. |
Beta Was this translation helpful? Give feedback.
-
You need to return all |
Beta Was this translation helpful? Give feedback.
You need to return all
ref()
,reactive()
,shallowReactive()
. Anything that is state. You only need to return functions and computed that are used outside of the store.