Parker Codes
Get array of matched nested routes
Another friend, Fabien (can't find him with
@
) had a great proposed solution:
The latest version of solid-router includes a new hook useCurrentMatches()
, so this is only available as of last week! Great timing for me and my team. 😄 https://github.com/solidjs/solid-router?tab=readme-ov-file#usecurrentmatches
Then for route metadata we can add an extra info
to each route.
Here's an example new hook he wrote based on this:
8 replies
Get array of matched nested routes
The best way I can think of doing this in userland is to traverse the tree and somehow check if each depth matches. I can't use
useMatch()
because it's a one-time check and not a signal subscription. I'd want to reutilize the same matching mechanism as the router to avoid discrepancy.8 replies