What is the difference between signal, computed and effect?

Angular signals and change detection · Freshers

Model answer

signal holds a writable value. computed derives a value from other signals, is read-only, lazy and cached: it recalculates only when a dependency changes. effect runs side-effect code, such as logging or saving to local storage, when the signals it reads change.

Rule of thumb: use computed for values you can calculate from other state, and avoid using effects to set other signals, because that makes data flow harder to follow.

Tips

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions