@cran/lib.vue.ref
Version:
Vue Reactivity Extensions
17 lines (12 loc) • 335 B
text/typescript
import { unwrap } from "../utility";
import { usePipe } from "./usePipe";
import { type Ref, type WatchSource, ref } from "vue";
/**
* @since 0.2.0
* @category Controller
*/
export function useRef<T> ( source: WatchSource<T> ) {
const target = ref(unwrap(source)) as Ref<T>;
void usePipe(source, target);
return target;
}