NgRx 18: SignalStore is Now the Default Recommendation

NgRx 18: SignalStore is Now the Default Recommendation

NgRx 18: SignalStore is Now the Default Recommendation

NgRx 18 marks a major shift in the NgRx ecosystem — the SignalStore (introduced in NgRx 17) is now the primary recommendation for state management in Angular applications, while the classic NgRx Store remains fully supported for larger enterprise use cases.

Why SignalStore Over Classic NgRx Store?

  • No actions, reducers, or effects boilerplate
  • Built on Angular Signals — fine-grained reactivity
  • Significantly less code for the same result
  • Excellent TypeScript inference

New: Deep Partial Updates

// patchState now supports deeply nested partial updates
patchState(store, {
  user: { address: { city: 'New York' } } // only city changes
});

New: withEntities Built-in

import { withEntities, setAllEntities } from '@ngrx/signals/entities';

export const ProductStore = signalStore(
  withState({ loading: false }),
  withEntities<Product>(),    // adds entities, ids, entityMap signals
  withMethods((store) => ({
    loadProducts: rxMethod<void>(pipe(
      switchMap(() => productService.getAll()),
      tap(products => patchState(store, setAllEntities(products)))
    )),
  }))
);
All Comments