Skip to content

Instantly share code, notes, and snippets.

@asherccohen
Created April 26, 2019 08:25
Show Gist options
  • Save asherccohen/8f61589f41978953bd877c48d1195f7f to your computer and use it in GitHub Desktop.
Save asherccohen/8f61589f41978953bd877c48d1195f7f to your computer and use it in GitHub Desktop.
const rootReducer = (state, action) => {
// when a logout action is dispatched it will reset redux state
if (action.type === 'USER_LOGGED_OUT') {
const { users, comment } = state;
state = { users, comment };
}
if (action.type === 'USER_LOGGED_IN') {
const { users, comment, orders } = state;
state = { users, comment, orders };
}
return appReducer(state, action);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment