The toReactive
utility function converts a MaybeRef
object to a reactive proxy, automatically unwrapping ref values. It provides special handling for Map
, Set
, and regular objects.
import { ref } from 'vue'
import { toReactive } from '@vuetify/v0'
const state = ref({ name: 'John', age: 30 })
const rstate = toReactive(state)
console.log(rstate.name) // 'John' (no .value needed)
Composable | Description |
---|---|
toArray→ | Convert value to array |
useProxyModel→ | Two-way binding with transformation |
toReactive
Type
function toReactive<Z extends object> (
objectRef: MaybeRef<Z>
): UnwrapNestedRefs<Z>
Details
Converts a MaybeRef
to a reactive proxy that automatically unwraps ref values. Provides special handling for:
get()
, and updates existing refs when using set()
Z represents the type of the object being converted.