Skip to content

vue-doctor/reactivity/no-ref-from-prop ​

Remove the ref and derive inline: const value = computed(() => transform(props.propName))

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

Why it matters ​

Remove the ref and derive inline: const value = computed(() => transform(props.propName))

How to fix ​

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

Agent Guidance ​

Do not copy a prop into a ref() that is never updated again; the copy goes stale when the prop changes. Use computed(() => props.x) for derived values, or emit an event to the parent when the value must be edited. Copies that are written later (an editable draft, a ref re-synced by watch(() => props.x, ...)) and initial*/default* seed props are not reported.


Rule source: vue-doctor/reactivity/no-ref-from-prop

Released under the MIT License.