Skip to content

Extending stores #929

Closed Answered by posva
jeffrey-hiraki asked this question in Help and Questions
Dec 29, 2021 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

You would use setup stores + Composables

export function useCommonStore() {
  const data = ref()

  function action() {}
  const getter = computed(() => data.value * 2)

  return { data, action, getter }
})

export const useStore = defineStore('id', () => {
  const { data, action, getter } = useCommonStore()

  return { data, action, getter }
})

Here is the Composable approach

Replies: 2 comments 1 reply

Comment options

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

Answer selected by posva
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants