Skip to content

Instantly share code, notes, and snippets.

@jsmanifest
Created June 22, 2019 04:30
Show Gist options
  • Save jsmanifest/dc0153d20e0a9af77e3ee2f3ad08aaff to your computer and use it in GitHub Desktop.
Save jsmanifest/dc0153d20e0a9af77e3ee2f3ad08aaff to your computer and use it in GitHub Desktop.
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