【问题标题】:React router onUpdate only on certain route changes仅在某些路由更改时对路由器 onUpdate 做出反应
【发布时间】:2019-02-01 06:58:00
【问题描述】:

我的索引文件上有这个渲染

render(
  <Provider store={store}>
    <Router history={browserHistory} routes={routes}
      onUpdate={() => window.scrollTo(0, 0)}/>
  </Provider>,
  document.getElementById('root')
)

我需要能够将以前的位置路径与新的位置路径进行比较。

我尝试在 onUpdate 中使用变量失败

谢谢

【问题讨论】:

    标签: reactjs react-router


    【解决方案1】:

    查看此帖子:react browser history

    我想你知道如何获得的当前位置..

    【讨论】:

    • 是的,我知道如何获取当前位置。我会检查帖子。谢谢你。编辑:我真的认为有一些更简单的东西。实际上,当查询字符串发生变化时,我需要阻止 onUpdate
    猜你喜欢
    • 2017-10-21
    • 2019-11-27
    • 2017-12-05
    • 2022-08-02
    • 2018-01-05
    • 1970-01-01
    • 2022-06-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多