Skip to content

Readable type

Home > @rimitive/signals > Readable

A readable reactive value (signal or computed).

Call with no arguments to read the current value. Reading inside a reactive context (effect, computed) creates a dependency.

Signature:

export type Readable<T> = {
(): T;
};
const count: Readable<number> = computed(() => items().length);
// Read the value
console.log(count()); // 5
// Reading inside effect creates dependency
effect(() => {
console.log(count()); // Tracks count as dependency
});