Relative, partial route match

Viewed 23

In React Router 6, how can a path be partially matched (relative to its hierarchy) without knowing the complete hierarchy? For example, if a navigation element is in the middle of the hierarchy, how can it match just the relative part of the path?

e.g. with the following routes:

/users
/users/1
/users/1/edit

Assuming there was a visual user picker which returned (just) the user's id - how could the current id be determined via the route alone?

Here is a code sandbox illustrating the same issue using MUI's Tabs component. The idea would be for the active tab to show as active (as in this demo)

0 Answers
Related