[英]react router page not able to refresh
我想尝试嵌套路由,但无法正常工作
场景:当我第一次在/ category / bags上路由时,它正确呈现,但是当我在此页面上刷新时,它给了我错误页面未找到
我尝试使用this.props.match.url和this.props.match.path,但是在这里出现错误,例如没有prop match.url
我尝试了以下链接
https://reacttraining.com/react-router/web/guides/quick-start
我看过您的代码,发现您在父级路由中使用的是完全相同的代码:
<Route exact path="/category" component={Category} />
如果您从父路由中删除了确切的路由,则可以正常运行:
<Route path="/category" component={Category} />
尝试使用ConnectedRouter from 'react-router-redux'
的BrowserRouter from 'react-router-dom'
而不是BrowserRouter from 'react-router-dom'
的BrowserRouter from 'react-router-dom'
我希望这篇文章可以对您有所帮助:
https://medium.com/@Dragonza/react-router-problem-with-gh-pages-c93a5e243819
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.