I want to redirect the user to another page when the onChange of the Switch component is triggered. The function works but it does not redirect to the other page.
function onChange(checked) {
console.log(`switch to ${checked}`);
{<Link to={`user/${checked.id}`}>{checked}</Link>}
}
class List extends PureComponent {
render() {
const columns = [
{
title: <Trans>OS</Trans>,
dataIndex: 'avatar',
key: 'avatar',
width: 72,
fixed: 'left',
render: text => <Avatar style={{ marginLeft: 8 }} src={text} />,
},
{
render: (e,text,record) => (< Switch onChange={onChange(text,record)}
defaultChecked={e} />)
},
}
]
}
}