Breadcrumbs with useMatches for nested urls without layout nesting #10205
Unanswered
Totteperera
asked this question in
Q&A
Replies: 0 comments
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.
-
Hi.
I need some help to figure out how I can use the useMatches() hook to be able to render a breadcrumbs component using nested urls without layout nesting
Routes Setup:
app.projects
app.projects_.$projectId
Results
Url:
/app/projects
useMatches:
Url:
/app/projects/123
useMatches:
Here I would have expected to get routes/app/projects (/app/projects) as step nr 3
So the route seems to exist, but useMatches does not seem to recognise the structure.
Could someone be kind to me and explain what I'm doing wrong?
Edit:
In my example above I'm using the file structure for routing. But in my actual project I'm using folders to structure my routes.
routes/app.projects./route.tsx
routes/app.projects_.$projectId/route.tsx
And I have tested with:
routes/app.projects./route.tsx
routes/app.projects.$projectId/route.tsx
Which generates the structure in useMatches that I want, but then with the nested Layout which I don't want.
Beta Was this translation helpful? Give feedback.
All reactions