Open
Description
const state = reactive({ count: 0 })
// count is disconnected from state.count when destructured.
let { count } = state
// does not affect original state
count++
// the function receives a plain number and
// won't be able to track changes to state.count
// we have to pass the entire object in to retain reactivity
callSomeFunction(state.count)
: Due to these limitations, we recommend using ref() as the primary API for declaring reactive state.
Is this reason for recommending the use of ref
tenuous? This demo
still doesn't work with ref
;
it feels like this restriction would be strange for those who understand the clarity and responsiveness principles.
Metadata
Metadata
Assignees
Labels
No labels