Skip to content

Doubts about Limitations of reactive() #3 #3255

Open
@momei-LJM

Description

@momei-LJM
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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions