【发布时间】:2021-08-30 06:28:05
【问题描述】:
我一般使用 Redirect 组件进行路由。由于我们需要返回重定向,这是可以理解的。但是,我对使用历史对象感到困惑。实际上在我的代码库中将一些路由推入历史堆栈后。有太多的动作和函数被调用。
什么时候挂载新的路由组件?如果有人看不懂,请看下面的示例代码。
const some_handler_func = () => {
history.push('/component 2');
setState('dummy');
console.debug('checking')
//what happens to the above two lines.
}
【问题讨论】:
标签: javascript reactjs react-router history