preact_signals library

Classes

Computed<T>
Create a new signal that is computed based on the values of other signals.
Effect
Create an effect to run arbitrary code in response to signal changes.
ReadonlySignal<T>
An interface for read-only signals.
Signal<T>
Instance of a new plain signal

Functions

batch<T>(T fn()) → T
Combine multiple value updates into one "commit" at the end of the provided callback.
computed<T>(T fn()) ReadonlySignal<T>
Create a new signal that is computed based on the values of other signals.
effect(dynamic fn()) → void Function()
Create an effect to run arbitrary code in response to signal changes.
readonly<T>(T value) ReadonlySignal<T>
Create a new plain readonly signal
signal<T>(T value) Signal<T>
Create a new plain signal
untracked<T>(T fn()) → T
Run a callback function that can access signal values without subscribing to the signal updates.