Entities and Custom Features
Manage collections with withEntities.
Managing Collections
Lists of records (todos, users, products) are so common that NgRx provides withEntities to manage them with normalized state and ready-made updater functions.
withEntities
withEntities stores items keyed by id in an entityMap plus an ordered ids array, and exposes an entities computed signal of the list.
import { withEntities } from '@ngrx/signals/entities';
export const TodoStore = signalStore(
withEntities<Todo>()
);
// store.entities() -> Todo[]All lessons in this course
- Creating a SignalStore
- Computed and Methods
- rxMethod for Async Work
- Entities and Custom Features