Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/toReactive.md
1---2category: Reactivity3---45# toReactive67Converts ref to reactive. Also made possible to create a "swapable" reactive object.89## Usage1011```ts12import { toReactive } from '@vueuse/core'13import { ref } from 'vue'1415const refState = ref({ foo: 'bar' })1617console.log(refState.value.foo) // => 'bar'1819const state = toReactive(refState) // <--2021console.log(state.foo) // => 'bar'2223refState.value = { bar: 'foo' }2425console.log(state.foo) // => undefined26console.log(state.bar) // => 'foo'27```2829## Type Declarations3031```ts32/**33* Converts ref to reactive.34*35* @see https://vueuse.org/toReactive36* @param objectRef A ref of object37*/38export declare function toReactive<T extends object>(39objectRef: MaybeRef<T>,40): UnwrapNestedRefs<T>41```42