
Angular 20: Complete Guide to Signals for State Management
Learn how to leverage Angular 20 signals for reactive state management with computed properties and fine-grained reactivity.
Angular 20 introduced signals, a powerful new primitives for fine-grained reactivity. This represents a major shift in how we manage state in Angular applications.
What are Signals?
Signals are a way to store and manage reactive state in Angular. Unlike RxJS observables, signals are values that notify consumers when they change. They're synchronous and provide better performance characteristics for many use cases.
Key Benefits of Signals:
- Fine-grained Reactivity: Only components that depend on a signal are updated when it changes
- No Subscription Management: No need to unsubscribe or worry about memory leaks
- Better Performance: Synchronous updates mean less overhead
- Cleaner Code: Signal-based code is often more intuitive
Basic Usage:
Creating a simple signal is straightforward:
const count = signal(0);
Accessing the value:
const currentValue = count(); // Get the value
Updating the value:
count.set(5); // Set to 5
count.update(val => val + 1); // Update with function
Computed Signals:
Computed signals derive their value from other signals:
const count = signal(0);
const doubled = computed(() => count() * 2);
Effect Pattern:
When you need side effects, use effects:
effect(() => {
console.log('Count changed:', count());
});
Best Practices:
- Use signals for local component state
- Use RxJS for async operations (HTTP, timers)
- Combine signals with observables using toSignal()
- Keep signals focused - one responsibility per signal
- Use computed for derived values
Migration Strategy:
You don't need to rewrite everything immediately. Both RxJS and signals can coexist:
const httpData$ = this.http.get('/api/data');
const data = toSignal(httpData$);
Conclusion:
Signals represent the future of Angular state management. They offer better performance and cleaner code patterns. Start using them in new components and gradually migrate existing code as needed.

