小编Ada*_*čka的帖子

如何在有状态组件中的 react router 5.1.2 中使用 history.push('path') ?

如何在有状态组件(类组件)中的 react router 5.1.2 中使用 history.push('path') ?

我找到了这个,但它是无状态组件的解决方案。

import { useHistory } from "react-router-dom";

function App() {
  let history = useHistory();
}
Run Code Online (Sandbox Code Playgroud)

reactjs react-router react-router-dom

12
推荐指数
2
解决办法
2万
查看次数

标签 统计

react-router ×1

react-router-dom ×1

reactjs ×1