Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何剥离react-router v4的路由 #128

Open
lyxverycool opened this issue Jun 10, 2021 · 4 comments
Open

如何剥离react-router v4的路由 #128

lyxverycool opened this issue Jun 10, 2021 · 4 comments

Comments

@lyxverycool
Copy link

lyxverycool commented Jun 10, 2021

请问有升级到 react-router-dom v5嘛?或者如何剥离react-router v4的路由,最近想实现keep-alive,但是路由没办法修改

@llh911001
Copy link
Member

路由是强耦合的,暂时无法剥离哈

@lyxverycool
Copy link
Author

lyxverycool commented Jun 10, 2021

那大佬请问在这个框架下,有没有方法实现keep-alive这种功能呢?感谢

@llh911001
Copy link
Member

如果 keep-alive 你指的是“路由变化不引起组件的 unmount” ,那么即便是在 react-router v4 下,你也可以自己实现这个功能:通过动态路由( <Route path="/:pathname">)来控制子组件即可

@lyxverycool
Copy link
Author

好的,感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants