createTrackedEffect
Creates a tracked reactive effect where dependency tracking and side effects happen in the same scope.
WARNING: Because tracking and effects happen in the same scope, this primitive may run multiple times for a single change or show tearing (reading inconsistent state). Use only when dynamic subscription patterns require same-scope tracking.
createTrackedEffect(compute, options?: { name?: string });Import
import { createTrackedEffect } from "solid-js";Type signature
function createTrackedEffect( compute: () => void | (() => void), options?: BaseEffectOptions): void;Parameters
compute
A function that contains reactive reads to track and returns an optional cleanup function to run on disposal or before next execution
options
-- name
Examples
createTrackedEffect(() => { const target = focusedNode(); if (!target) return;
const handler = () => log(target.value()); target.on("change", handler);
return () => target.off("change", handler);});