Commit 12e8b126 authored by Tim Neutkens's avatar Tim Neutkens Committed by Arunoda Susiripala

Document usage of <Link> without <a> (#2369)

parent 3d162d9d
...@@ -319,6 +319,8 @@ export default () => ( ...@@ -319,6 +319,8 @@ export default () => (
That will generate the URL string `/about?name=Zeit`, you can use every property as defined in the [Node.js URL module documentation](https://nodejs.org/api/url.html#url_url_strings_and_url_objects). That will generate the URL string `/about?name=Zeit`, you can use every property as defined in the [Node.js URL module documentation](https://nodejs.org/api/url.html#url_url_strings_and_url_objects).
##### Replace instead of push url
The default behaviour for the `<Link>` component is to `push` a new url into the stack. You can use the `replace` prop to prevent adding a new entry. The default behaviour for the `<Link>` component is to `push` a new url into the stack. You can use the `replace` prop to prevent adding a new entry.
```jsx ```jsx
...@@ -329,6 +331,18 @@ export default () => ( ...@@ -329,6 +331,18 @@ export default () => (
) )
``` ```
##### Using a component that support `onClick`
`<Link>` supports any component that supports the `onClick` event. In case you don't provide an `<a>` tag, it will only add the `onClick` event handler and won't pass the `href` property.
```jsx
// pages/index.js
import Link from 'next/link'
export default () => (
<div>Click <Link href='/about'><img src="/static/image.png"></Link></div>
)
```
#### Imperatively #### Imperatively
<p><details> <p><details>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment