Skip to content

Instantly share code, notes, and snippets.

@brakmic
Created April 11, 2017 10:20
Show Gist options
  • Save brakmic/9ea7777fdf30085312f113c6f9b1a268 to your computer and use it in GitHub Desktop.
Save brakmic/9ea7777fdf30085312f113c6f9b1a268 to your computer and use it in GitHub Desktop.
combine all of the reducers into one meta-reducer
const developmentReducer: ActionReducer<IAppState> = compose(storeFreeze, combineReducers)(reducers);
const productionReducer: ActionReducer<IAppState> = combineReducers(reducers);
// our meta-reducer will take care of forwarding all actions
export function AppReducer(state: any, action: any) {
if (String('<%= BUILD_TYPE %>') === 'dev') {
return developmentReducer(state, action);
} else {
return productionReducer(state, action);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment