'How to delete a list item from ant design List?
Solution 1:[1]
If you check the API for List.Item
there is a prop called extra
which accepts JSX
and you can add the buttons their. For eg:
<List
size="large"
header={<div>Header</div>}
footer={<div>Footer</div>}
bordered
dataSource={data}
renderItem={(item) => (
<List.Item extra={<Button size="small">Delete</Button>}>
{item}
</List.Item>
)}
/>
You can also check working demo here: https://codesandbox.io/s/polished-fast-hzl9m?file=/index.js:477-755
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Yash Joshi |