Skip to content

State Management

Effective state management is crucial for building scalable Angular applications. This section covers the most popular state management libraries and patterns used in modern Angular development.

NGXS Fundamentals — Jumpstart with NGXS state management:

  • What is NGXS and core concepts
  • Setting up NGXS in your project
  • Defining stores, actions, and selectors
  • Managing application state
  • Best practices and patterns

NgRx with Signals — Mastering scalable state management:

  • NgRx fundamentals and architecture
  • Combining NgRx with Angular signals
  • Store, effects, and selectors
  • Performance optimization
  • Scalable, predictable, performant applications

NgRx Standalone Setup — Complete NgRx setup for standalone components:

  • Setting up NgRx in standalone Angular applications
  • Store configuration
  • Actions and reducers
  • Effects and side effects
  • Testing and best practices

Best Practices — Master patterns and practices for scalable state management:

  • Core principles (immutability, pure functions, single source of truth)
  • State structure best practices and normalization
  • Selector patterns and memoization
  • Action and reducer best practices
  • Effects and side effect handling
  • Performance optimization strategies
  • Testing patterns and anti-patterns
  • Migration strategies and checklists

AspectNGXSNgRx
Learning CurveGentler, more intuitiveSteeper, more verbose
Bundle SizeSmaller (~20KB)Larger (~80KB+)
PerformanceGoodExcellent with optimization
CommunitySmaller but activeLarge and established
Signals SupportBasicFull integration available
DevToolsBuilt-inExcellent Redux DevTools
Use CaseSmall to medium appsLarge, complex applications

  1. Start with Best Practices — Understand the core principles and patterns
  2. Choose Your Library — NGXS for simplicity, NgRx for scale
  3. Follow the Setup Guide — Use the appropriate setup guide for your choice
  4. Reference Best Practices — Refer back to patterns as you build

  • ✅ Multiple components need shared state
  • ✅ State changes across different parts of the app
  • ✅ Need centralized state management
  • ✅ Complex application logic
  • ✅ Want time-travel debugging
  • ✅ Team size growing
  • ❌ Simple component hierarchies
  • ❌ Local component state only
  • ❌ Small application
  • ❌ Using signals for all state
  • ❌ Over-engineering simple problems

Simple local state within components using Angular’s built-in tools.

export class Component {
count = signal(0);
}

Manage state in services, often with observables.

@Injectable({ providedIn: 'root' })
export class StateService {
private state = new BehaviorSubject<Data>(initial);
state$ = this.state.asObservable();
}

Decorator-based state management with stores.

Functional, Redux-inspired state management with full ecosystem.

Combine signals with lightweight state management for optimal performance.


New to state management? Start with NGXS for a gentler introduction.

Building large-scale apps? Explore NgRx for maximum control and scalability.

Want modern patterns? Learn how to combine NgRx with Angular signals.

Pick a guide above and start building predictable, scalable applications!