Skip to content

Instantly share code, notes, and snippets.

@adamrenklint
Last active October 28, 2015 07:10
Show Gist options
  • Save adamrenklint/a9ee6750ef1649fcc979 to your computer and use it in GitHub Desktop.
Save adamrenklint/a9ee6750ef1649fcc979 to your computer and use it in GitHub Desktop.
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