[✨] useRouteSegments #143
brandonpittman
started this conversation in
Proposals For Qwik
Replies: 1 comment
-
|
We moved this issue to |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem?
I'd like to be able to access information about each route segment. I'm trying to recreate something similar to Remix's
useMatches. It's handy to set some data in a route or layout and be able to fetch it in a parent layout. Think breadcrumbs.Describe the solution you'd like
I'd like to be able to call
useRouteSegementsoruseMatchesand get back an array with each matched route segment'sheadexport. Remix has ahandleexport they use for this, but I think we could reuse theheadexport and stick stuff in thefrontmatterkey.Describe alternatives you've considered
I've been playing around with adding stuff to a layout or route's
frontmatterin theheadexport. It kind of works, but you need each declaration to have some knowledge of its possible child routes. If we had an array with each matched route segment, we could just declare this kind of data and read it in a parent layout:Then, hopefully, the
useRouteSegmentsfunction would return something like this:Beta Was this translation helpful? Give feedback.
All reactions