📌  相关文章
📜  redux 如果已经存在的项目不添加到数组中 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:03.760000             🧑  作者: Mango

代码示例1
Element won't be duplicated and always at 0 index,

return {
    ...state,
    data: {
      ...state.data,
      list: [].concat(action.payload.list, state.data.list.filter(val=>val.id==action.payload.list.id))
    }
  }