react-router - 网址栏中的父路径重复

标签 react-router history.js relayjs

使用:

"react-router": "^2.0.0",
"react-router-relay": "^0.9.0",

当我在父路径下推送任何链接时,对于每个新的 router.push 调用,父路径都会在 URL 栏中重复一次。
// http://localhost:3000

router.push('auth/profile')
// http://localhost:3000/auth/profile

router.push('auth/profile')
// http://localhost:3000/auth/auth/profile

router.push('auth/browse')
// http://localhost:3000/auth/auth/auth/browse

当我记录 location (来自 react-router )时,它不显示重复项。也许浏览器正在将父路径推到基本名称上?

最佳答案

改变

router.push('auth/profile')


router.push('/auth/profile')

修复了这个。

关于react-router - 网址栏中的父路径重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35443526/

相关文章:

javascript - React-router:使用 hashHistory.push 刷新子页面内容

relayjs - 继电器: Conditionally include fields in mutation's fat query

reactjs - React Relay 更新根查询作为突变胖查询的一部分

webpack - babelRelayPlugin、transform-runtime、passPerPreset 是做什么的? (babel+webpack配置)

redux - 如何根据状态更改索引路由

reactjs - 使用 redux 保护的路由和身份验证响应路由器 v4

javascript - <Switch> 组件匹配 react-router-4 中的空值

javascript - History.JS - replaceState 追加

javascript - 有没有办法告诉 history.js 状态的发展方向?

javascript - 如何使用 Backbone.js 获得 HTML5 历史记录持久化?