Skip to content

Commit

Permalink
docs: Improve docs for link function child (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Mar 22, 2019
1 parent 8161f02 commit 3e9a65c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,19 @@ const link2 = (
Bar widget with query
</Link>
);

const link3 = (
<Link
to={{
pathname: '/widgets/bar',
query: { the: query },
}}
>
{({ href, active, onClick }) => (
<CustomButton href={href} active={active} onClick={onClick} />
)}
</Link>
);
```
`<Link>` accepts the following props:
Expand Down
9 changes: 2 additions & 7 deletions test/Link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,8 @@ describe('<Link>', () => {
it('should support functional children', async () => {
const link = await mountWithRouter(
<Link to="/" otherProp="foo">
{({ href, active, onClick, props }) => (
<CustomComponent
{...props}
href={href}
active={active}
onClick={onClick}
/>
{({ href, active, onClick }) => (
<CustomComponent href={href} active={active} onClick={onClick} />
)}
</Link>,
);
Expand Down

0 comments on commit 3e9a65c

Please sign in to comment.