[英]How to skip over a page in history (with react-router/js)
Assume I have the following 3 paths: '/home' '/folder' '/folder/file'. 假设我有以下3条路径:'/ home''/ folder''/ folder / file'。
When the user visits '/folder/', it automatically redirects him to '/folder/file'. 当用户访问“ / folder /”时,它将自动将其重定向到“ / folder / file”。
However, this breaks the following flow: 但是,这中断了以下流程:
At this point, the user would get stuck in this infinite loop because the previous point in history is /folder which redirects him back to /folder/file. 此时,用户将陷入无限循环,因为历史记录中的上一个点是/ folder,它会将他重定向回/ folder / file。
My question is: How do I skip over '/folder' in history (when I hit backspace in /folder/file) and go directly to the last page in history that is not /folder. 我的问题是:如何跳过历史记录中的“ / folder”(当我在/ folder / file中单击退格键)并直接转到历史记录中不是/ folder的最后一页。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.