How to return specific state using getters? #700
Answered
by
posva
jamols09
asked this question in
Help and Questions
-
Is there a way for me to return multiple state on getters? I know I can just call all the values of the state from exporting Most of the examples show only one state being returned from a getter.
|
Beta Was this translation helpful? Give feedback.
Answered by
posva
Oct 4, 2021
Replies: 1 comment 1 reply
-
You can return an object: defineStore('id', {
state: () => ({ ... }),
getters: {
stuff: state => ({ one: state.one, two, state.two }),
},
}) Remember you can directly use the state of the store and that there is mapState() and storeToRefs() to help |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
posva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can return an object:
Remember you can directly use the state of the store and that there is mapState() and storeToRefs() to help