Skip to main content
Vuetify0 is now in beta!
Vuetify0 Logo
Theme
Mode
Palettes
Accessibility
Vuetify One
Sign in to Vuetify One

Access premium tools across the Vuetify ecosystem — Bin, Play, Studio, and more.

Not a subscriber? See what's included

toReactive

Converts a MaybeRef object to a reactive proxy with automatic ref unwrapping and Map/Set support.

Usage

ts
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)

Architecture

toReactive creates a Proxy that unwraps ref values:

Reactivity

toReactive converts a MaybeRef into a fully reactive proxy with automatic ref unwrapping. This is the primary way to eliminate .value syntax.

BehaviorReactiveNotes
Object accessProperties are reactive, refs auto-unwrapped
Map operationsget/set/entries unwrap ref values
Set operationsIteration unwraps ref values
Array accessIndex access unwraps nested refs
Tip

When to use Use toReactive when you want to:

  • Eliminate .value in templates

  • Pass reactive state to non-Vue code expecting plain objects

  • Create reactive proxies over ref-wrapped collections

Examples

API Reference

The following API details are for the toReactive composable.
Was this page helpful?

Ctrl+/