Created
April 16, 2017 23:34
-
-
Save chris-burgin/fc4f04b7db09b1b46c8c017304ce6d89 to your computer and use it in GitHub Desktop.
Object Literal Redux Store Reducer
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
// **************** | |
// Reducer Imports | |
// **************** | |
import { | |
// users | |
DELETEUSER, | |
UPDATEUSER, | |
ADDUSER, | |
ADDUSERS | |
} from "./reducers/index.js" | |
// **************** | |
// Switch Logic | |
// **************** | |
const reducerSwitch = { | |
// users | |
"ADDUSER": ADDUSER, | |
"ADDUSERS": ADDUSERS, | |
"DELETEUSER": DELETEUSER, | |
"UPDATEUSER": UPDATEUSER, | |
} | |
// **************** | |
// Reducer Switch | |
// **************** | |
const AppReducers = (state, action) => | |
reducerSwitch[action.type](state, action) // execute the reducer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment