Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Update docs on Fragment #217

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ You can use `withConditions` in conjunction with `forRoute` to set strict condit

To show a `Fragment` when other `Fragment`s match a route, use `<Fragment forNoMatch />`.

`<Fragment>` lets you nest fragments to match your UI hierarchy to your route hierarchy, much like the `<Route>` component does in `react-router@v3`. Given a URL of `/about/bio/dat-boi`, and the following elements:
`<Fragment>` lets you nest fragments to match your UI hierarchy to your route hierarchy, much like the `<Route>` component does in `react-router@v3`. Given the following elements:

```jsx
<Fragment forRoute='/about'>
Expand All @@ -284,7 +284,7 @@ To show a `Fragment` when other `Fragment`s match a route, use `<Fragment forNoM
</Fragment>
```

...React will render:
...with the URL `/about/bio/dat-boi`, React will render:

```html
<div>
Expand Down Expand Up @@ -312,6 +312,24 @@ To show a `Fragment` when other `Fragment`s match a route, use `<Fragment forNoM
</Fragment>
```

The order in which `<Fragment/>`s are declared matters, as redux-little-router will render the the first matching Fragment and ignore the rest.

```jsx
<Fragment forRoute='/'>
<div>
<Fragment forRoute='/'>
<div>Home</div>
</Fragment>
<Fragment forRoute='/foo'>
<div>Foo</div>
</Fragment>
<Fragment forRoute='/foo/bar'>
<div>Foo Bar -- will not show for a url of /foo/bar, because the /foo Fragment matched</div>
</Fragment>
</div>
</Fragment>
```

### `<Link>`

Using the `<Link>` component is simple:
Expand Down