Created
September 5, 2018 11:18
-
-
Save Maluen/bbfb03f67e09f42249c7df404b27c3e5 to your computer and use it in GitHub Desktop.
Root reducer with ROOT_RESET action to reset the state back to its initial value
This file contains 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 { combineReducers } from 'redux'; | |
import * as reducers from './index'; | |
const appReducer = combineReducers({ | |
...reducers, | |
}); | |
const rootReducer = (state, action) => { | |
if (action.type === 'ROOT_RESET') { | |
state = undefined; | |
} | |
return appReducer(state, action); | |
}; | |
export default rootReducer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment