Last active
October 28, 2015 07:10
-
-
Save adamrenklint/a9ee6750ef1649fcc979 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'; | |
function user(state = {}, action) { | |
switch (action.type) { | |
case UPDATE_USERNAME: | |
return { | |
...state, | |
name: action.payload | |
}; | |
} | |
return state; | |
} | |
function userSettings(state = {}, action) { | |
switch (action.type) { | |
case UPDATE_SETTING: | |
return { | |
...state, | |
[action.payload.key]: action.payload.value | |
}; | |
case RESET_SETTINGS: | |
return { ...defaults }; | |
} | |
return state; | |
} | |
export default combineReducers({ user, userSettings }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment