hxn

Computed

  • Type parameters: T

A value derived from signals and other computed values, and cached until one of them changes. SolidJS calls this a memo.

It is computed on first read. It is recomputed only when a dependency has changed and either it is read again or an effect depends on it. If the new value equals the old one, its dependents do not rerun.

Constructor

function new(compute:() -> T, ?equals:(T, T) -> Bool)

Properties

var value(get, null):T

Reads the value and subscribes the reader, computing it first if needed.

var get(default, null):() -> T
var dispose(default, null):() -> Void

Unsubscribes from its dependencies. A computed value created inside an effect is disposed with that effect.