Last active
August 14, 2019 05:58
-
-
Save JurajMlich/b26629d4b61690960a78eb14afe4a49d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ActionReducer, ActionReducerMap, MetaReducer} from '@ngrx/store'; | |
import {State} from './root.state'; | |
import {environment} from '../../environments/environment'; | |
export const rootReducers: ActionReducerMap<State> = { | |
// YOUR REDUCERS HERE | |
}; | |
export const rootMetaReducers: MetaReducer<State>[] = []; | |
if (environment.hmr) { | |
rootMetaReducers.push((reducer: ActionReducer<any>): ActionReducer<any> => { | |
return function (state: any, action: any) { | |
if (action.type === 'SET_ROOT_STATE') { | |
return action.payload; | |
} | |
return reducer(state, action); | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated ;)