Link Component - Palmabit-IT/Sacajawea GitHub Wiki
This component is an extension of next/link
. For other options see the documentation of next/link
// pages/index.js
import { Link } from '../routes'
export default () => (
<div>
<div>Welcome to Next.js!</div>
<Link route='blog' params={{slug: 'hello-world'}}>
<a>Hello world</a>
</Link>
or
<Link route='/blog/hello-world' locale='it'>
<a>Hello world</a>
</Link>
</div>
)
Props:
name | required | example | note |
---|---|---|---|
route |
✔ | home |
Name of route page that you want to go |
locale |
✔ | it |
locale of the rout |
params |
✗ | {a: 1} |
Optional parameters for named routes |
It generates the URLs for href
and as
and renders next/link
. Other props like prefetch
will work as well.