我需要在antd表中设置道具handleRemove
才能将其传递到另一个组件。我无法从类render方法执行此操作,而且我不知道如何从下面的antd render处理它
这是我的桌子的样子
render() {
const { handleRemove} = this.props; //This does not work
return (
<Table
dataSource={users}
columns={
[
{
dataIndex: 'firstName',
key: 'firstName',
title: 'First Name',
},
{
dataIndex: 'lastName',
key: 'lastName',
title: 'Last Name',
},
{
key: 'action',
render: (text, record) => (
<Popconfirm
title="Are you sure you want to remove item?"
onConfirm={() => props.handleRemove(record.id)} // Error is from here
>
<Icon className={DANGER} type={DELETE} />
</Popconfirm>
),
title: 'Action',
},
]
}
rowKey={record => record.id}
/>
);
}