Option store reactivity vs ref #1680
Unanswered
Lilja
asked this question in
Help and Questions
Replies: 1 comment 1 reply
-
You can do it like this, but export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const name = ref('Eduardo')
const doubleCount = computed(() => count.value * 2)
function increment() {
count.value++
}
return { count, name, doubleCount, increment }
}) In Setup Stores:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As far as I can tell, if you define a state through the option store, your properties will end up as vue's
ref
props. But what if I want it to usereactive
? Do I need to use the composition API style?Example:
Beta Was this translation helpful? Give feedback.
All reactions