I'm trying to use this reducer from ReduxJs site with NgRx and Angular Cli:
function createFilteredReducer(reducerFunction, reducerPredicate) {
return (state, action) => {
const isInitializationCall = state === undefined;
const shouldRunWrappedReducer = reducerPredicate(action) || isInitializationCall;
return shouldRunWrappedReducer ? reducerFunction(state, action) : state;
}
}
But I'm getting this error with prod build:
ERROR in app/app.module.ts(504,29): Error during template compile of 'AppModule' Function expressions are not supported in decorators in 'reducers' 'reducers' contains the error at app/reducers/index.ts(106,9) Consider changing the function expression into an exported function.
Do you have any ideas how can I achieve this functionality with a code that compiles in prod mode?