【问题标题】:AntD Table navigate to other route on clickAntD Table 导航到其他路由点击
【发布时间】:2021-10-19 06:45:36
【问题描述】:

我在导航组件中使用 React Router,但是当用户单击表格元素时,我想从屏幕 Y 导航到屏幕 X。 在使用 antD 之前,我通过使用 this 来做到这一点,但是在这里不起作用。

    return {
      onClick: event => {
              
      },
   };
}

【问题讨论】:

  • 能否请您展示您尝试过的内容?或者你的桌子看起来怎么样?

标签: reactjs typescript antd ant-design-pro


【解决方案1】:

你可以使用 react-routers useHistory 钩子

const history = useHistory()
//...
// somewhere else in the code
onClick={() => history.push("/route")} 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-24
    • 2017-01-01
    • 2019-02-13
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多