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

    This hook version allows the ref 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.


    Takes an inner value and returns a reactive and mutable ref object, which has a single property .value that points to the inner value.

    Example

    // Inside a function component:
    const count = useRef(1)

    See

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

    Type Parameters

    • T

    Parameters

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

      The object to wrap in the ref, or a function that returns the object.

    Returns Ref<UnwrapRef<T>>

Generated using TypeDoc