Skip to content

Instantly share code, notes, and snippets.

@rich-at-thinkful
Last active March 29, 2022 18:29
Show Gist options
  • Save rich-at-thinkful/99dc55d10755b9ccc17c4feef32d026e to your computer and use it in GitHub Desktop.
Save rich-at-thinkful/99dc55d10755b9ccc17c4feef32d026e to your computer and use it in GitHub Desktop.
Example Breadcrumb React Component (w/ Bootstrap)
import { Link } from "react-router-dom";
export default function Breadcrumbs({ crumbs }) {
return (
<nav>
<ol className="breadcrumb">
{crumbs.map((crumb, index) =>
<li key={index} className={`breadcrumb-item ${!crumb.linkUrl && "active"}`}>
{ crumb.linkUrl ?
<Link to={crumb.linkUrl}>{crumb.label}</Link> :
crumb.label
}
</li>
)}
</ol>
</nav>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment