版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33455771/article/details/83379593
// 如果使用hashHistory
import creatHistory from 'history/createHashHistory'
// 如果使用createBrowserHistory
import creatHistory from 'history/createBrowserHistory'
const history = creatHistory();
history.goBack();
下面的截图是打印history的结果:
相关API:https://reacttraining.com/react-router/web/api/history