Need help with Breadcrumb component using Shadcn UI and Tanstack Router
Hi everyone,
I'm trying to build a breadcrumb component using Shadcn UI and Tanstack Router, but I'm running into some issues. I found some code online that I've been trying to use, but it's not working as expected.
The code I've been using looks like this:
And this is how I'm defining my routes:
I'm using this code in a demo repository [https://codesandbox.io/p/github/SagarBarpete03/shadcn-tanstack-router/main], but the breadcrumbs are not displaying correctly. For example, when I'm on the "new-post" page, the breadcrumbs show "home > new-post" instead of "home > post > new-post". And when I'm on the "post-1" page, the breadcrumbs show "home > post-1" instead of "home > post > 1".
Can someone please help me figure out what I'm doing wrong? I'd really appreciate any guidance or suggestions on how to properly implement a breadcrumb component using Shadcn UI and Tanstack Router.
Thank you!
1 Reply
like-gold•9mo ago
Did you find a solution?