Created
June 22, 2019 04:30
-
-
Save jsmanifest/dc0153d20e0a9af77e3ee2f3ad08aaff 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
const appReducer = combineReducers({ | |
app, | |
form: formReducer, | |
}) | |
// Higher order reducer that resets the redux state when we dispatch a logout action | |
const rootReducer = (state, action) => { | |
if (['LOGOUT'].includes(action.type)) { | |
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