AntD Table 单击时导航到其他路由
AntD Table navigate to other route on click
我在导航组件中使用 React Router,但我想在用户单击 table 元素时从屏幕 Y 导航到屏幕 X。
在使用 antD 之前,我是通过使用它来做到这一点的,但是在这里不起作用。
return {
onClick: event => {
},
};
}
你可以使用 react-routers useHistory
hook
const history = useHistory()
//...
// somewhere else in the code
onClick={() => history.push("/route")}
我在导航组件中使用 React Router,但我想在用户单击 table 元素时从屏幕 Y 导航到屏幕 X。 在使用 antD 之前,我是通过使用它来做到这一点的,但是在这里不起作用。
return {
onClick: event => {
},
};
}
你可以使用 react-routers useHistory
hook
const history = useHistory()
//...
// somewhere else in the code
onClick={() => history.push("/route")}