Signals · core
signal, computed and effect
A signal holds a value you read by calling it. A computed is a lazy, cached value derived from signals. An effect runs a side effect when signals change.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
signal(value): read by callingcount(), change withsetorupdate.- Reading a signal inside a reactive context (a template, a
computed, aneffect) records a dependency. computed(() => ...)is read-only, lazy and memoised. It runs when read after a dependency changed. Dependencies are tracked dynamically.- Signals compare with
Object.is.updatethat returns the same array reference signals no change, so dependents are not notified. - Always return a new array or object from
update:items.update(list => [...list, item]). effectis for side effects such as logging, storage or calling non-Angular code. It is not for deriving values.- Signals are the main way to hold state in Angular (facts.md).
The red pen
Common traps: mistake → fix
Mistake:
items().push(x)updates the screenFix: the signal sees the same reference and sends no notification.
Mistake: An effect is the way to compute one value from another
Fix: use
computed.
Easy to hard
Questions interviewers ask, easy to hard
- What is the difference between signal, computed and effect?
- Why does
items.update(l => { l.push(x); return l })not updatecount? - When is an effect the right tool?
- Is computed lazy or eager?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.