Created
April 25, 2019 08:12
-
-
Save asherccohen/72d918daafcb0de8deb39f95a77d9202 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
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