Replies: 3 comments 1 reply
-
Hi @mperrando, can you elaborate on the use case? Maybe this can be achieved at the router level, e.g. intercepting the URL change and performing the desired action, but it would be helpful to have some context here. |
Beta Was this translation helpful? Give feedback.
-
A developer could use the Breadcrumb component for some other purposes than change the window location. Imagine a case where a page contains a section that can be navigated by the user, but the rest of the page must remain unchanged; here one would like to use a Breadcrumb inside that section to update only that specific part of the page, without a full reload of the whole page. Another case could be one where there is a very complex hierarchical view of a large amount of elements that are presented in a position not related to the hierarchy, but to some other relation among the elements. About the URL interception, even if it is possibile to set it up, isn't quite cumbersome for a developer to do it, only in order to perform a simple action, such as, for example, modifying the state of a React component? |
Beta Was this translation helpful? Give feedback.
-
Hello @gabro. I reopen this issue because we are having a hard time preventing navigation (e.g. when a user has some unsaved data) when a user clicks a breadcrumb with the href property, inside a It seems impossible to disallow the navigation in a href link. Using the https://reactrouter.com/en/6.22.1/hooks/use-blocker seemed the right direction, but AFAIK it can be only used with We have built a customisation of the When you wrote "this can be achieved at the router level, e.g. intercepting the URL change and performing the desired action", what did you have in mind? Can you elaborate a bit so that we can understand how to effectively forbid a navigation? |
Beta Was this translation helpful? Give feedback.
-
As an alternative to the href property, which issues a navigate command, I would be glad to use a callback in order to implement my own behaviour on breadcrumb click.
E.g.
Beta Was this translation helpful? Give feedback.
All reactions