如何在有状态组件(类组件)中的 react router 5.1.2 中使用 history.push('path') ?
我找到了这个,但它是无状态组件的解决方案。
import { useHistory } from "react-router-dom"; function App() { let history = useHistory(); }
reactjs react-router react-router-dom
react-router ×1
react-router-dom ×1
reactjs ×1