Replies: 3 comments 3 replies
-
In this case it should be renamed to |
Beta Was this translation helpful? Give feedback.
-
Since I asked that I figured another solution is to handle it in the custom Button/Link implementation which wraps onClick in useTransition and adds appropriate pending styles. The downside is that now every button has this behavior, but it was recommended by react devs so I guess it's okay. |
Beta Was this translation helpful? Give feedback.
-
@phaux do you have a Codesandbox or anything like this? It would be great to have a look at your solution :) |
Beta Was this translation helpful? Give feedback.
-
So there's a
useLocationPending
hook which is great. I want to display an indicator when the next page is loading, but only on the button which triggered navigation to that page.I can put the last clicked button in state and if the location is pending then I can render the indicator, but the problem with it is that if the user clicks a link in other component, then the indicator won't disappear. I'd need to have some kind of global state which just holds last clicked link, but that seems like a hack.
It would be nice if
useLocationPending
would return the url it's transitioning to or null when not transitioning.Beta Was this translation helpful? Give feedback.
All reactions