Next.js Discord

Discord Forum

I need help to review my breadcrumb component

Unanswered
Yacare Caiman posted this in #help-forum
Open in Discord
Avatar
Yacare CaimanOP
Hi, I creating a custom breadcrumb which disable Link when the route is not found.
Example: I have two route is /dashboard ans /dashboard/temp. In route /dashboard, I don't create page.tsx then this route will be 404. So on breadcrumb Home > Dashboard > Temp, the dashboard is unclickable

My method is to get segments from useSelectedLayoutSegments() then send these segments to Server Actions, then use fs to check is there any page.tsx file that exists in those combined segments. Is that valid? I wonder if using Route Handler or Server Actions is suitable in this case.

This is my code: https://codesandbox.io/p/devbox/sweet-morning-pl7nmp
Please try route /dashboard/temp to check the breadcrumb

1 Reply

Avatar
Yacare CaimanOP