export function updateItem(oldObject = {}, newValues) {
  return { ...oldObject, ...newValues };
}

export function updateItemsInObject(obj = {}, items) {
  return items.reduce((acc, item) => ({
    ...acc,
    [item.id]: updateItem(obj[item.id], item)
  }), {});
}

export function createReducer(initialState, handlers) {
  return function reducer(state = initialState, action) {
    if (action.type in handlers) {
      return handlers[action.type](state, action);
    }
    return state;
  };
}


@@ -144,16 +144,28 @@
 %7D, items
+, key = 'id'
 ) %7B%0A  re
@@ -221,19 +221,21 @@
    %5Bitem
-.id
+%5Bkey%5D
 %5D: updat
@@ -252,11 +252,13 @@
 item
-.id
+%5Bkey%5D
 %5D, i

Update reducers