使用:
"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/