App Reducer

Create application reducer and meta reducer.

Also like normal NgRX apps, add a reducer map to your app.state.ts file. We recommend creating this file in a root state directory, located at src/app/state.

app.state.ts
import { ActionReducerMap, MetaReducer } from '@ngrx/store';
import { IEntityState } from '@briebug/ngrx-auto-entity';
import { environment } from '../../environments/environment';

export interface AppState {
  // todo: add each entity state interface to our application state interface
}

export const appReducer: ActionReducerMap<AppState> = {
  // todo: add each entity reducer
};

With NgRx 8 and up, runtime checks have replaced the need to use the storeFreeze meta reducer. As such, a standard state configuration no longer requires any meta reducers.

Last updated