Skip to content

Instantly share code, notes, and snippets.

@asherccohen
Created April 25, 2019 08:12
Show Gist options
  • Save asherccohen/72d918daafcb0de8deb39f95a77d9202 to your computer and use it in GitHub Desktop.
Save asherccohen/72d918daafcb0de8deb39f95a77d9202 to your computer and use it in GitHub Desktop.
import { combineReducers } from 'redux';
import AppReducer from './AppReducer';
import UsersReducer from './UsersReducer';
import OrderReducer from './OrderReducer';
import NotificationReducer from './NotificationReducer';
import CommentReducer from './CommentReducer';
const appReducer = combineReducers({
/* your app’s top-level reducers */
users: UsersReducer,
orders: OrderReducer,
notifications: NotificationReducer,
comment: CommentReducer,
});
const rootReducer = (state, action) => {
// when a logout action is dispatched it will reset redux state
if (action.type === 'USER_LOGGED_OUT') {
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