API reference > @kontsedal/olas-vue > useValue
useValue() function
A read-only ref over any ReadSignal: a signal, a computed, a Field, a Form or a FieldArray. Reading the ref reads the signal's current value, so it never lags a write. With isEqual, a value equal to the one the ref last returned counts as unchanged: the ref keeps returning the earlier value, as React's useValue does. The subscription ends with the component (the current effect scope). Outside any scope nothing ends it, and a development build warns. A server render reads the signal and does not subscribe.
ts
const count = useValue(api.count) // count.value in script, {{ count }} in a templateSignature:
typescript
export declare function useValue<T>(signal: ReadSignal<T>, options?: UseValueOptions<T>): Readonly<Ref<T>>;Parameters
Parameter | Type | Description |
|---|---|---|
signal | ReadSignal<T> | |
options | (Optional) |
Returns:
Readonly<Ref<T>>