• Shallow version of ().

    Unlike (), there is no deep conversion: only root-level properties are reactive for a shallow reactive object. Property values are stored and exposed as-is - this also means properties with ref values will not be automatically unwrapped.

    Type Parameters

    • T extends object

    Parameters

    • target: T

      The source object.

    Returns ShallowReactive<T>

    Example

    const state = shallowReactive({
    foo: 1,
    nested: {
    bar: 2
    }
    })

    // mutating state's own properties is reactive
    state.foo++

    // ...but does not convert nested objects
    isReactive(state.nested) // false

    // NOT reactive
    state.nested.bar++

    See

    https://vuejs.org/api/reactivity-advanced.html#shallowreactive

Generated using TypeDoc