-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please added feature disabledLink to allow to disable link if not needed #41
Comments
@phatify - all additional pass-through props (props that aren't part of the So your code should look something like this instead: EDIT (disabledLink needs to be nested in a props object within config - I forgot to include this. in the original response) const breadcrumbs = useBreadcrumbs([
{ path: "/", breadcrumb: "Home" },
{ path: "/product", breadcrumb: "Product", props: { disabledLink: true } },
{ path: "/product/add", breadcrumb: "New Product" }
]); return (
<>
{ breadcrumbs.map((data, i) => {
const { match, breadcrumb, disabledLink } = data;
return (
<BreadcrumbComponent key={match.pathname}>
{disabledLink ?
<>{breadcrumb}</>
:
<Link to={match.pathname}>{breadcrumb}</Link>
}
</BreadcrumbComponent>
)
})}
</>
) |
@icd2k3 Have you tried yet? It not works, bro! I got the |
@phatify I forgot to post the route config as well - pass through props have to be placed in a const breadcrumbs = useBreadcrumbs([
{ path: "/", breadcrumb: "Home" },
{ path: "/product", breadcrumb: "Product", props: { disabledLink: true } },
{ path: "/product/add", breadcrumb: "New Product" }
]); Here's a codesandbox example of the functionality you're looking for I think https://codesandbox.io/s/use-react-router-breadcrumbs-demo-forked-vxhvn?file=/Breadcrumbs.js |
This props option is also noted in the api section of the readme but might be worth having it's own section if we see more questions like this |
@icd2k3 Thanks for your answer. Its saved my time. :))) |
No problem @phatify and sorry for the confusion - I've adjusted the "advanced" example in the readme slightly to highlight the |
Please update this feature, this will be useful in some cases
, I mentioned an example for usage below:
The text was updated successfully, but these errors were encountered: