怎么把commentLists中的index传递到APP.js中
commentsList.js handleDelete(index){console.log(index)this.props.delete(index);}render (){const {comments} = this.props;return (<div className="comment-list-compenent"><label>评论列表</label><ul className="list-group mb-3">{comments.map((comment, index) =><likey={index}className="list-group-item"onClick = {this.handleDelete}index = {index}>{comment}</li>)}</ul></div>)}
DeleteItem(index){
const list = [...this.state.comments];
list.splice(index, 1);
this.setState({
comments: list //如果key和值是一样的直接写一个就行了
});
}