I am working on a new project with NGRX store. NGRX store is not instantiating. When I use redux develop tool in chrome it always show me undefined. I have attached the intial structure of my ngrx store. Please let me know what is missing. Thank you
app.reducers.ts
import { ActionReducerMap, combineReducers } from '@ngrx/store';
import { PointReducers } from '../point/shared/store/point.reducers';
import { AppState } from './app.state';
export const appReducers: ActionReducerMap<AppState> = {
point: combineReducers({
closingTab: PointReducers.closingTab,
configTab: PointReducers.configTab,
postTab: PointReducers.postTab,
})
};
app.state.ts
import { PointMainState } from '../point/shared/store/point-main.state';
export interface AppState {
point: PointMainState;
}
store.index.ts
import { StoreModule } from '@ngrx/store';
export const StoreRootModuleIndex = [
StoreModule.forRoot(
{},
{
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false,
strictStateSerializability: false,
strictActionSerializability: false
}
}
)
];
store.reducers.ts
import { Action, ActionReducer } from '@ngrx/store';
import { AppState } from './app.state';
export function storeMetaReducers(reducer: ActionReducer<any>) {
return function (state: AppState | undefined, action: Action) {
const newState = reducer(state, action);
return newState;
};
}
You have to add the reducers to the config. https://ngrx.io/guide/store/reducers#registering-root-state
export const StoreRootModuleIndex = [
StoreModule.forRoot(
// ๐ add reducers here
{},
{
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false,
strictStateSerializability: false,
strictActionSerializability: false
}
}
)
];