Skip to content

How to return specific state using getters? #700

Discussion options

You must be logged in to vote

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

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jamols09
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants