Vue 3 factory returning shallowRef (default) or deepRef
npm install vue-create-ref
A Vue 3 composition API utility that returns a shallowRef by default, or a deepRef when the deep parameter is true. Useful for conditional reactivity depth control.
``bash`
npm install vue-create-ref
`ts
import { createRef } from 'vue-create-ref'
import { isShallow } from 'vue'
const initialData = 1
// Create shallow ref (default)
const shallowData = createRef(initialData)
// Create deep ref
const deepData = createRef(initialData, true)
console.log(isShallow(shallowData)) // true
console.log(isShallow(deepData)) // false
``
MIT
Extracted from VueUse for standalone use.