我有一个 react 单页应用程序,因此按后退按钮后,它会按预期将我重定向到欢迎页面。现在,由于某些要求,我必须更新应用程序的 URL,因此,如果现在我按后退按钮,它首先将我重定向到旧 URL 页面,然后是欢迎页面。 我如何控制这种行为,意味着即使在更新 URL 后,用户也应该在按后退按钮时直接重定向到欢迎页面。
最佳答案
I think you can make use of react-router-dom here. There is Link element available in react-router-dom which can solve your problem.
For eg:, you can try something like this
<Link to="/welcomePage" >Back</Link>
For more information, go through below document react-router-dom document
关于reactjs - 在 react 单页应用程序中按后退按钮重定向到欢迎页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47628540/