Advanced / Specialized Reactivity & Tracking

createReaction

Creates a reactive computation that runs after the render phase with flexible tracking.

const track = createReaction(effectFn, options?: EffectOptions);
track(() => { // reactive reads });

Import

import { createReaction } from "solid-js";

Type signature

function createReaction(
effectFn: EffectFunction<undefined> | EffectBundle<undefined>,
options?: EffectOptions
);

Parameters

effectFn

A function (or EffectBundle) that is called when tracked function is invalidated

options

EffectOptions -- name, defer


Examples

const [count, setCount] = createSignal(0);
const track = createReaction(() => {
console.log("count changed once, re-arm to listen again");
track(() => count()); // re-arm
});
track(() => count()); // initial arm
setCount(1); // logs once, reaction re-armed for next change
Last updated: 7/4/26, 6:21 PMEdit this pageReport an issue with this page