• The hook version of reactive from @vue/reactivity. In addition to values accepted by reactive, you can also pass an initializer function returning the value.

    This hook version allows the reactive object to be created when the component first renders, then cached for future re-renders. If you pass in an initializer function, it will only be called on first render.


    Returns a reactive proxy of the object.

    The reactive conversion is "deep": it affects all nested properties. A reactive object also deeply unwraps any properties that are refs while maintaining reactivity.

    Example

    const obj = useReactive({ count: 0 })
    

    Example

    const obj = useReactive(() => ({ count: 0 }))
    

    See

    https://vuejs.org/api/reactivity-core.html#reactive

    Type Parameters

    • T extends object

    Parameters

    • initialValue: T | (() => T)

      The source object, or a function that returns the object.

    Returns UnwrapNestedRefs<T>

Generated using TypeDoc