Skip to content

Files

Latest commit

 

History

History
22 lines (16 loc) · 611 Bytes

no-ref-object-destructure.md

File metadata and controls

22 lines (16 loc) · 611 Bytes

Pattern: Destructuring ref object

Issue: -

Description

This rule reports the destructuring of ref objects causing the value to lose reactivity.

import { ref } from 'vue'
const count = ref(0)
const v1 = count.value /* ✗ BAD */
const { value: v2 } = count /* ✗ BAD */
const v3 = computed(() => count.value /* ✓ GOOD */)
const v4 = fn(count.value) /* ✗ BAD */
const v5 = fn(count) /* ✓ GOOD */
const v6 = computed(() => fn(count.value) /* ✓ GOOD */)

Further Reading