Skip to content

Commit 13fa63e

Browse files
committed
Add explicit click handler to FancyLink example
1 parent 70c5136 commit 13fa63e

File tree

1 file changed

+6
-4
lines changed
  • packages/react-router-dom/docs/api

1 file changed

+6
-4
lines changed

packages/react-router-dom/docs/api/Link.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,14 @@ let anchorRef = React.createRef()
8484

8585
## component: React.Component
8686

87-
If you would like utilize your own navigation component, you can simply do so by passing it through the `component` prop.
87+
If you would like utilize your own navigation component, you can do so by passing it through the `component` prop.
8888

8989
```jsx
90-
const FancyLink = React.forwardRef(({ navigate, ...props }, ref) => (
91-
<a ref={ref} {...props}>💅 {props.children}</a>
92-
))
90+
const FancyLink = React.forwardRef(({ navigate, ...props }, ref) => {
91+
return (
92+
<a ref={ref} {...props} onClick={handleClick}>💅 {props.children}</a>
93+
)
94+
})
9395

9496
<Link to="/" component={FancyLink} />
9597
```

0 commit comments

Comments
 (0)