Skip to content

I can't understand this sentence.If use destructures for ref ,should still lose reactivity concection.Unless destructures result is an Object,the reactivity concection will lost #11291

Closed Answered by s3xysteak
dddssw asked this question in Help/Questions
Discussion options

You must be logged in to vote

It means you should use:

function useFunc() {
  return {
    one: ref(1)
  }
}

instead of

function useFunc() {
  return reactive({ one: 1 })
}

Destructures them, in the first example you will get:

const { one } = useFunc() // one = ref(1)

in the second example you will get:

const { one } = useFunc() // one = 1 instead of a Proxy, which means it has lost the reactivity

Replies: 1 comment 1 reply

Comment options

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

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