老师,我的list删除功能不能实现
来源:6-12 使用React-redux完成TodoList功能
郑斌斌
2018-07-06
老师,我看了6-10完成了list的删除,
handleDelete(index){
const action = {
type:"delete_item",
index
}
dispatch(action)
}
可是
if(action.type === 'delete_item'){
const newState = {...state};
newState.list.splice(action.index,1);
console.log(newState.list); //这里打出来删掉了
return newState;
} 页面中没有删除掉,是为什么呢写回答
4回答
-
慕雪3469186
2018-09-06
handleDeleteItem.bind(this,index)
10 -
慕粉2325311140
2018-08-07
index是通过什么方法传递到handleDelete的?
00 -
Dell
2018-07-07
找一找别的地方问题,应该不是这里问题
00 -
Dell
2018-07-07
你看下你的reducer是否正常使用了,代码看起来没问题的
042018-10-26
相似问题