untrack
Runs fn outside of any reactive tracking — reads inside fn will not
subscribe the current scope. Returns whatever fn returns.
Use untrack inside a memo or effect when you need to read a signal once
without making the surrounding computation depend on its future changes.
Pass a strictReadLabel string to enable a dev-mode warning: any reactive
read inside fn that isn't inside a nested tracking scope will log a
warning naming the label.
Import
import { untrack } from "solid-js";Type signature
function untrack<T>(fn: () => T, strictReadLabel?: string | false): T;Examples
createEffect( () => trigger(), // tracks `trigger` only () => { const snapshot = untrack(() => state); // read once, untracked log(snapshot); });