Property 'replaceReducer' does not exist o

2019-08-20 20:24发布

In my Angular app, I have a function which replaces replaces the current reducer used by the Store. However, after upgrade from @ngrx/store v2.2.2 to v6.1.0, "replaceReducer" function seems to have been removed from the Store interface.

I've gone through the NGRX migration guide (https://github.com/ngrx/platform/blob/master/MIGRATION.md) hoping to find a possible solution or an alternative way to go around the issue but I can't find any reference to the removed "replaceReducer" function interface.

Here is my code:

export const accountingModuleReducer: ActionReducer<State> = createReducer(reducers);

export function accountingStoreFactory(appStore: Store<fromRoot.State>) {
  appStore.replaceReducer(accountingModuleReducer);
  return appStore;
}

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-20 20:53

Replace Reducer has been deprecated. Checkout this issue to see an alternative way to approach this problem. Also checkout the StoreModule.forFeature() docs here, which might help you out.

查看更多
登录 后发表回答