Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
icd2k3 authored Mar 31, 2020
1 parent a0b9c1f commit acc1dca
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,40 @@ Pathname | Result

## Already using a [route config](https://reacttraining.com/react-router/web/example/route-config) array with react-router?

Just add a `breadcrumb` prop to your routes that require custom breadcrumbs.
Add breadcrumbs to your existing [route config](https://reacttraining.com/react-router/web/example/route-config). This is a great way to keep all routing config in a single place!

`{ path, component }` -> `{ path, component, breadcrumb }`
For example...

`withBreadcrumbs(routeConfig)(MyComponent)`
```js
const routeConfig = [
{
path: "/sandwiches",
component: Sandwiches
}
];
```

becomes...

```js
const routeConfig = [
{
path: "/sandwiches",
component: Sandwiches,
breadcrumb: 'I love sandwiches'
}
];
```

then you can just pass the whole route config right into the hook:

```js
const breadcrumbs = useBreadcrumbs(routeConfig);
```

## Disabling default generated breadcrumbs

This package will attempt to create breadcrumbs for you based on the route section. For example `/users` will auotmatically create the breadcrumb `"Users"`. There are two ways to disable default breadcrumbs for a path:
This package will attempt to create breadcrumbs for you based on the route section. For example `/users` will automatically create the breadcrumb `"Users"`. There are two ways to disable default breadcrumbs for a path:

**Option 1:** Disable _all_ default breadcrumb generation by passing `disableDefaults: true` in the `options` object

Expand Down

0 comments on commit acc1dca

Please sign in to comment.