我有以下使用'loadash'从我的ReactJS脚本的对象数组中删除元素的方法。如何添加另一种方法来用新值更新同一对象(UPDATE_TICKET)?
case ActionTypes.DELETE_TICKET:
_.remove(_tickets, ticket => (action.id === ticket.id));
TicketStore.emitChange();
样本数据:
"tickets": [
{
"id": 1,
"name": "test1",
"desc": "test1"
},
{
"id": 2,
"name": "test2",
"desc": "test2"
}
]