Skip to content

Instantly share code, notes, and snippets.

@timdeschryver
Created May 26, 2018 14:59
Show Gist options
  • Select an option

  • Save timdeschryver/19f1f92186af1f1a40a4c54aafe5a609 to your computer and use it in GitHub Desktop.

Select an option

Save timdeschryver/19f1f92186af1f1a40a4c54aafe5a609 to your computer and use it in GitHub Desktop.
export const reducer = produce<State, CatalogActions>((draft, action) => {
switch (action.type) {
case CatalogActionTypes.Load:
action.payload.products.forEach(product => {
draft.products[product.sku] = product;
draft.productSkus.push(product.sku);
});
}
}, initialState);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment