Skip to content

Instantly share code, notes, and snippets.

@mweststrate
Last active January 12, 2018 08:04
Show Gist options
  • Save mweststrate/b1408d8117faf05e31d4742a34cfec7e to your computer and use it in GitHub Desktop.
Save mweststrate/b1408d8117faf05e31d4742a34cfec7e to your computer and use it in GitHub Desktop.
immer producer with currying
const byId = produce((draft, action) => {
switch (action.type) {
case RECEIVE_PRODUCTS:
action.products.forEach(product => {
draft[product.id] = product
})
break
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment