Home > Enterprise >  How can I solve this error with ngrx/store
How can I solve this error with ngrx/store

Time:12-03

I faced an error using StoreModule.forRoot() in angular project with NgRX. I will attach a picture of my error if anyone can help with a solution for it.

I was trying to implement reducers in angular using ngrx/store but I faced a problem while importing it in app.module. Image of error

CodePudding user response:

It's been a while since I used that syntax it it might be a regression bug. You can assert it to an ActionReducerMap

StoreModule.forRoot({ tutorial: reducer } as ActionReducerMap<any,any>)

Also, I would suggest to take a look at the createAction and createReducer syntax - it makes things simpler.

CodePudding user response:

Try importing it like this :

  StoreModule.forRoot(ROOT_REDUCERS, {
  metaReducers: ROOT_META_REDUCERS,
  runtimeChecks: {
    // NB:
    // Neccessery in order to be able to use Router state.
    strictStateImmutability: false,
    strictActionImmutability: false,
  },
}),
  • Related