#Deep routes with route matching

2 messages · Page 1 of 1 (latest)

tidal shard
#

Hi,

Anyone here that knows of a way to create deeply nested routes where it is possible to use useMatches (or any other function) for creating breadcrumbs?

__root.tsx
index.tsx
posts.tsx (set breadcrumb title in context)
posts_.$postId.tsx (set breadcrumb title in context)

In the posts_.$postId.tsx I want to render a breadcrumb where I have access to the title set in posts.tsx.

Am I approaching this the wrong way maybe? I need to do deep nesting as I do not want an <Outlet /> in my posts.tsx

tidal shard
#

I ended up using posts.tsx with an outlet and setting title in the context to Posts. And posts.index.tsx file for listing posts and setting title in context to undefined. I then only render breadcrumbs from matches that have a title set in context.