Angular Signals (signal, computed, effect)
What are the key trade-offs of Angular Signals (signal, computed, effect)? When would you choose it vs alternatives?
Answers use simple, clear English.
Quick interview answer
Pros: Predictable reactivity; better performance mental model. Cons: Migration from RxJS-heavy patterns takes learning.
Detailed answer
Pros: Predictable reactivity; better performance mental model. Cons: Migration from RxJS-heavy patterns takes learning. Decision: pick when benefits outweigh operational cost. Core: Signals are reactive primitives: signal() writable, computed() derived, effect() side effects. Fine-grained updates reduce reliance on Zone.js change detection for many cases. Real-time example: cartCount = computed(() => items().reduce(...)); template reads cartCount(). Pros: Predictable reactivity; better performance mental model. Cons: Migration from RxJS-heavy patterns takes learning. Common mistakes: Writing to signals inside computed; infinite effect loops. Best practices: Prefer signals for local UI state; RxJS for async streams still fine. Audience level: Senior.
Full explanation
Signals are reactive primitives: signal() writable, computed() derived, effect() side effects. Fine-grained updates reduce reliance on Zone.js change detection for many cases.
Real example & use case
cartCount = computed(() => items().reduce(...)); template reads cartCount().
Pros & cons
Pros: Predictable reactivity; better performance mental model. Cons: Migration from RxJS-heavy patterns takes learning.
Common mistakes
Writing to signals inside computed; infinite effect loops.
Best practices
Prefer signals for local UI state; RxJS for async streams still fine.
Follow-up questions
- How would you test Angular Signals (signal, computed, effect)?
- What metrics prove Angular Signals (signal, computed, effect) is healthy in prod?
- How does Angular Signals (signal, computed, effect) change at 10× traffic?