Skip to content

Reactivity Signals And Effects

Chris Michael edited this page Jul 18, 2026 · 2 revisions

Effuse

Reactivity, Signals, And Effects

signal(value)
computed(() => value)
watch(source, callback)
watchEffect(effect)

Status: Current.

Effuse uses fine-grained reactive dependencies. Reading a signal inside a tracked computation subscribes that computation to later writes.

Writable Signals

const count = signal(0);
count.value += 1;

Computed Values

const total = computed(() => price.value * quantity.value);

Computed values are read-only signals and update from their dependencies.

Watch

watch(
  count,
  (next, previous, onCleanup) => {
    const request = startRequest(next);
    onCleanup(() => request.abort());
  },
  { immediate: true }
);

watch observes one source. watchMultiple observes a typed tuple of signals or getter functions. watchEffect discovers dependencies from the effect body.

Reactive Objects

The core package also exports reactive, readonly, shallowReadonly, isReactive, isReadonly, toRaw, and markRaw.

Use signals for explicit scalar ownership. Use reactive objects when object shape and property-level access are the natural domain model.

Template Reads

Signals can be passed into JSX children. The renderer tracks and updates the dependent DOM work. The compiler package can optimize JSX/TSX transformation, but runtime reactivity does not depend on a virtual DOM.

Effect Ownership

Effects created in component script or hook contexts should be disposed with their lifecycle. Standalone effects return handles with stop() for explicit ownership.

Boundaries

  • Async work is not automatically cancelled unless the API exposes or registers cleanup.
  • Ordinary variable reads are not reactive.
  • A computed getter should be pure; use effects for external synchronization.
  • Deep watching traverses object graphs and should be used deliberately.

Related

Clone this wiki locally