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-keep-alive都没有成功 #8

Closed
LastStranger opened this issue Apr 9, 2019 · 3 comments
Labels
invalid This doesn't seem right

Comments

@LastStranger
Copy link

window.location.href这种跳转,返回还能缓存吗?
跳转之后返回是不是不应该触发componentDidMount?但是每次都触发了这个生命周期,

@LastStranger
Copy link
Author

window.location.href这种跳转,返回能保存状态吗? 还是说只能在组件之间跳转的时候保存状态 ?

@ShenChang618
Copy link
Member

window.location.href这种跳转,返回还能缓存吗?
跳转之后返回是不是不应该触发componentDidMount?但是每次都触发了这个生命周期,

#5 可以在这里得到答案,希望提出一些改善建议😄

@ShenChang618
Copy link
Member

window.location.href这种跳转,返回能保存状态吗? 还是说只能在组件之间跳转的时候保存状态 ?

是的只能在组件之间跳转时使用,window.location.href 跳转相当于刷新页面,可以看这篇文章 ShenChang618/Blog#3

@ShenChang618 ShenChang618 added the invalid This doesn't seem right label Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants