简体   繁体   English

为什么反应路由器 url 更改但组件未加载到我的嵌套路由器应用程序中

[英]why react router url changes but component does not load in my nested router app

react-router URL changes but the component do not load. react-router URL 更改但组件未加载。 my app content lots off the nested router.我的应用程序内容与嵌套路由器无关。 see my layout看我的布局反应应用布局

in this app my main two problem 1. redirect 2. component not load在这个应用程序中我的主要两个问题 1. 重定向 2. 组件未加载

see this gif video what is my problem看这个gif视频我的问题是什么

why react router url changes but component does not load in my nested router app为什么反应路由器 url 更改但组件未加载到我的嵌套路由器应用程序中

I share gif video because of my gif size big than 2mb.我分享 gif 视频,因为我的 gif 大小超过 2mb。 in this gif video, you see when clicking on the logout button than not redirect.在此 gif 视频中,您可以看到单击注销按钮而不是重定向。 second when clicking on the signup button my app not redirect.第二次点击注册按钮时,我的应用程序没有重定向。

plz tell me what is my problem请告诉我我的问题是什么

您只需要将组件包装在 withRouter 中。

<Route exact path="/mypath" component={withRouter(MyComponent)} />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM