fn
useToString
v0.0.14testeddemoReactively stringify a value, equivalent to computed(() => String(toValue(value))).
Examples
ts
const count = ref(42);
const str = useToString(count); // '42'ts
// works with getters
const label = useToString(() => `item-${id.value}`);Demo
Loading demo…
Signature
ts
export function useToString(
value: MaybeRefOrGetter<unknown>,
): ComputedRef<string>{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
value | MaybeRefOrGetter<unknown> | The source value (can be a ref, getter, or plain value) |
Returns
ComputedRef<string>The string representation of the value