The NgRx Signal Store is a state management solution for Angular applications that is built on top of Angular’s reactive signals, which were introduced in Angular 16. NgRx Signal Store is designed to be a more efficient and simpler alternative.
import { signalStore, withState } from '@ngrx/signals';
import { Book } from './book.model';
type BooksState = {
books: Book[];
isLoading: boolean;
filter: { query: string; order: 'asc' | 'desc' };
};
const initialState: BooksState = {
books: [],
isLoading: false,
filter: { query: '', order: 'asc' },
};
export const BooksStore = signalStore(
withState(initialState)
);