Skip to content

vue-doctor/reactivity/no-reactive-replace ​

Use Object.assign(state, newState) instead of replacing the reactive object reference

PropertyValue
CategoryReactivity
Default Severitywarning
Confidencemedium
FixableNo
Engineoxlint
Sincev1.0.0
Frameworksvue, nuxt

Why it matters ​

Use Object.assign(state, newState) instead of replacing the reactive object reference

How to fix ​

Review the finding and update the code according to best practices below.

Agent Guidance ​

Reassigning a reactive() variable breaks every existing reference to it. Mutate it in place with Object.assign(state, next), or switch to a ref and assign .value.


Rule source: vue-doctor/reactivity/no-reactive-replace

Released under the MIT License.