Ami*_*_DA 15 javascript url query-string reactjs next.js
我正在研究 NextJs 版本13.0.2和 ReactJs 版本18.2.0。我想在 URL 中传递查询字符串,但我得到:
Error: Invariant: attempted to hard navigate to the same URL /@workamirdanesh?w=true http://localhost:3000/@workamirdanesh?w=true
Run Code Online (Sandbox Code Playgroud)
当我访问http://localhost:3000/@workamirdaneshURL 时一切正常。但是当我添加像这样的查询字符串:?w=true并且它变成:时http://localhost:3000/@workamirdanesh?w=true,我收到上述错误。
我该如何解决它以及这里的问题是什么?显然,查询字符串不应该抛出错误,并且应该使用查询字符串之前的 URL 加载页面。
更新:我更新了 NextJs 版本13.0.7,问题仍然存在。
小智 6
遇到同样的问题
Unhandled Runtime Error
Error: Invariant: attempted to hard navigate to the same URL /listings/ http://localhost:3000/listings/
Run Code Online (Sandbox Code Playgroud)
似乎是在返回404页面时发生的,所以如果页面返回404并且您点击同一个链接,就会导致上述错误。
| 归档时间: |
|
| 查看次数: |
15774 次 |
| 最近记录: |