Dynamic breadcrumbs
In my app, you can only access a project on the route
/projects/:projectId
.
You can get to this route from /customers/:customerId
and from /projects
.
I want the breadcrumbs in /projects/:projectId
to show which path I actually came from so that the navigation makes sense.
I am using react router v6. How would you achieve this?
I'm thinking of creating a breadcrumbs context which updates a breadcrumbs
state whenever I am navigating. In the project page, I will then consume this context and check the state to display the right breadcrumb.
Not sure if this is the best approach since I need to now manage this breadcrumbs context every time I am navigating... What is the recommended solution? I am guessing this is a common requirement..0 Replies