Skip to content

Instantly share code, notes, and snippets.

@maxired
Created August 9, 2017 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxired/53c18a9796bd3b0ec61441a171895f00 to your computer and use it in GitHub Desktop.
Save maxired/53c18a9796bd3b0ec61441a171895f00 to your computer and use it in GitHub Desktop.
extract of https://stackoverflow.com/a/37266130 using lodash fp set
const store = createStore((state = {repoIds, reposById}, action) => {
switch (action.type) {
case UPDATE_TAG:
return set('reposById.1.tags[0]', {id: 213, text: 'Node.js'}, state);
default:
return state;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment