Infinite navigation loop - improve docs #10235
snowinmars
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi.
Main
There is a case, that causes infinite navigation loop, I think because of react optimizations. The fix is simple, but is it a good idea to add this case to docs as bad example?
Case
Do not open sandbox - it causes high CPU usage. Code from sandbox is attached below.
The issue is in react component state reinitialization.
<Navigate />
causes<Redirector />
remount, but react does not resetuseState
values.The fix is simple:
useNavigate
.Current docs tells us to prefer
useNavigate
over<Navigate />
, but does not tells why. Here is why.Beta Was this translation helpful? Give feedback.
All reactions