Skip to main content
Helios uses a signals-based reactive system for state management.

signal()

Creates a reactive signal.
T
required
Initial value of the signal
Signal<T>
A signal object with:
  • value: Current value (read/write)
  • peek(): Read value without subscribing
  • subscribe(): Subscribe to changes

Example

computed()

Creates a computed value that automatically updates when dependencies change.
() => T
required
Function that computes the value (can access other signals)
ReadonlySignal<T>
A readonly signal that recomputes when dependencies change

Example

effect()

Creates a side effect that runs when dependencies change.
() => void
required
Function to run when dependencies change
() => void
Function to stop the effect and clean up

Example

untracked()

Reads signals without creating dependencies.
() => T
required
Function to run without tracking dependencies
T
Return value of the function

Example

Signal

Interface for a writable signal.

value

Gets or sets the current value. Reading creates a dependency in effects/computed.

peek()

Reads the current value without creating a dependency.

subscribe()

Subscribes to value changes.

ReadonlySignal

Interface for a readonly signal (like computed values).

Complete example

Hot vs cold computed

Computed values are:
  • Hot: When they have active subscribers (actively listening to dependencies)
  • Cold: When they have no subscribers (dependencies tracked but not subscribed)
This optimization reduces memory usage and unnecessary computations for unused computed values.