The untracked
function in Angular allows you to read a signal's value without causing the effect or computed signal to re-evaluate when that signal changes.
Effects will only re-evaluate when tracked dependencies change.
untracked
always accepts a callback function that returns the value of the underlying signal. Outside untracked
, reading the signal is reactive, but inside untracked
, the same read becomes non-reactive.