USENAVIGATE替换选项做什么?
The docs say:
Either pass a
To
value (same type as<Link to>
) with an optional
second{ replace, state }
arg or
without saying what it does. So does it replace the whole history stack or just the current route? I have no idea.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
替换
选项属性是替换导航操作。这是一个重定向,取代了历史记录堆栈中的当前条目,而不是像常规导航那样将新条目推向顶部。usenavigate
The
replace
options property is a REPLACE navigation action. It's a redirect, replacing the current entry in the history stack versus PUSHing a new entry onto the top like a regular navigation.useNavigate
您也可以使用它;
有关更多详细信息,请参见此处; https://reactrouter.com/en/main/main/hooks/hooks/use-luse-location
You can also use it like;
See here for more details; https://reactrouter.com/en/main/hooks/use-location