use-react-router-breadcrumbs icon indicating copy to clipboard operation
use-react-router-breadcrumbs copied to clipboard

Ability to have react components for the default formatter?

Open paul23-git opened this issue 3 years ago • 1 comments

Well I wish to use as default formatting not a <span> object but rather a <Link> (from material ui) component that has a specific calculation like:

const BreadCrumbDefault = observer(function(props: BreadcrumbComponentProps) {
    const fin = props.match.pathname.lastIndexOf('/')
    const rt = props.match.pathname.substring(fin + 1) || 'home'
    return <Link underline="hover"
                 href={props.match.pathname}
                 color="inherit">
        {rt}
    </Link>;
});
```

paul23-git avatar Jul 20 '22 13:07 paul23-git

Hi @pulli23 - because this utility returns an array, you should be able to render the breadcrumbs however you want. I suggest using Link in the map like the advanced example in the docs uses NavLink?

icd2k3 avatar Jul 20 '22 18:07 icd2k3