old_contents: import update from "immutability-helper"
  
  const user = (state = [], action) => {
    switch (action.type) {
    case "ADD_USERS":
      return action.users
    case "UPDATE_USER":
      const { userToken, newAttributes } = action
      const index = state.findIndex(user => user.token === userToken)
      return update(state, {
        [index]: { $set: { ...state[index], ...newAttributes } }
      })
    default:
      return state
    }
  }
  
  export default user
  
new_contents: const user = (state = [], action) => {
    switch (action.type) {
    case "ADD_USERS":
      return action.users
    case "UPDATE_USER":
      const { userToken, newAttributes } = action
      return state.map(user => {
        return (user.token === userToken) ? { ...user, ...newAttributes } : user
      })
    default:
      return state
    }
  }
  
  export default user
  
subject: use .map with equality check rather than immutability helpers with index