Creating a <Link/> from a `match` and filtering matches to remove layout routes
Hi, I'm building a breadcrumb component. Previously when using an older version of router, I used the
useMatches hook but have now replaced that with useRouter().state.matches as it contains the context type on each match.
The first problem I have is that useRouter().state.matches returns layout routes as well as regular routes. useMatches did not do this. Is there a recommended why of filtering those out?
Secondly, am I able to create a <Link/> from a particular match? I've tried <Link id={match.id} params={match.params} search={match.search} />, but that doesn't work. I think that makes sense because it doesn't know if each of those three parameters are the correct type for each other.
Thank you!0 Replies