render里面写成
<List.Item onClick={props.deleteItem(index)}
报错
Render methods should be a pure function of props and state.
改成下面就可以了,不使用箭头函数渲染的时候会默认执行deleteItem方法
<List.Item onClick={()=>props.deleteItem(index)}
render里面写成
<List.Item onClick={props.deleteItem(index)}
报错
Render methods should be a pure function of props and state.
改成下面就可以了,不使用箭头函数渲染的时候会默认执行deleteItem方法
<List.Item onClick={()=>props.deleteItem(index)}