Returns the inner value if the argument is a ref, otherwise return the argument itself. This is a sugar function for val = isRef(val) ? val.value : val.
val = isRef(val) ? val.value : val
Ref or plain value to be converted into the plain value.
function useFoo(x: number | Ref<number>) { const unwrapped = unref(x) // unwrapped is guaranteed to be number now} Copy
function useFoo(x: number | Ref<number>) { const unwrapped = unref(x) // unwrapped is guaranteed to be number now}
https://vuejs.org/api/reactivity-utilities.html#unref
Returns the inner value if the argument is a ref, otherwise return the argument itself. This is a sugar function for
val = isRef(val) ? val.value : val
.