Skip to content

Instantly share code, notes, and snippets.

@gnaeus
Created April 26, 2017 13:10
Show Gist options
  • Save gnaeus/883494e8e014a97616c6a33b4198059c to your computer and use it in GitHub Desktop.
Save gnaeus/883494e8e014a97616c6a33b4198059c to your computer and use it in GitHub Desktop.
function usersReducer(state, action) {
switch (action.type) {
case CHANGE_NAME:
const { id, name } = action.payload;
return {
byId: protoMerge(state.byId, {
[id]: {
...state.byId[id],
name: name,
}
}),
allIds: state.allIds,
};
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment