I have an antd table displaying my data. However, how would I ensure that when the user clicks on a specific row, it will redirect him to a new component named "ViewLog" with the row data?
Code that I provided below doesn't work:
<Table bordered
className="components-table-demo-nested"
onRow={(i) => ({
onClick: (e) => {
return <Link to={"/admin/ViewLog"}></Link>;
},
})}
columns={columns}
expandable={{ expandedRowRender }}
dataSource={data}
size="small"
/>
Edit your code as following and your code might work:
onRow={(i) => ({
onClick: (e) =>
history.push('/admin/ViewLog')
})}