@w5s/applicationFunctionsuseRefuseRef CallableuseRef<V>(hostObject, key, initialValue): Ref<V>Return a new Ref stored at storage.get(key) or ref.value[key]@exampleconst globalStorage = useStorage(globalThis);const counterRef = useRef<number>(globalStorage, 'counter', 1);// globalStorage == Map { counter => 1 }const state = Ref({});const counterRef = useRef<number>(state, 'counter', 2);// state == { counter: 2 }
Return a new
Refstored atstorage.get(key)orref.value[key]