Skip to content

Instantly share code, notes, and snippets.

@tamhv
Created March 21, 2018 02:36
Show Gist options
  • Save tamhv/9e2e5c49f71c701affd4430fb98a8fce to your computer and use it in GitHub Desktop.
Save tamhv/9e2e5c49f71c701affd4430fb98a8fce to your computer and use it in GitHub Desktop.
reset redux state by action
# delete all state alter log out
const appReducer = combineReducers({
todos,
visibilityFilter
});
const rootReducer = ( state, action ) => {
if ( action.type === LOG_OUT ) {
state = undefined;
}
return appReducer(state, action)
}
const store = createStore(rootReducer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment