【发布时间】:2017-10-02 08:16:06
【问题描述】:
每个对象都不同,我需要能够找到具有文件名的对象并删除我尝试使用索引和以下但没有真正工作的整个数组项
case actionTypes.PHOTO_DELETE:
// return state.filter((photo) => photo.filename !== action.data)
return { photos: state.photos.filter(photo =>
photo.filename !== action.data
)}
// let index = state.photos.findIndex((photo) => photo.fillname === action.data);
//console.log(index)
/*
var index = _.findIndex(action.data, function(photos) {
return photos.photos == action.data
})
*/
//return update(state, {photoGroups: {$splice: [[index]]}});
【问题讨论】:
标签: reactjs react-native redux react-redux