2016-12-15 19:13:40 +00:00
|
|
|
import Link, { prefetch } from 'next/prefetch'
|
2016-12-20 20:44:23 +00:00
|
|
|
import RegularLink from 'next/link'
|
2016-12-15 19:13:40 +00:00
|
|
|
|
|
|
|
export default () => (
|
|
|
|
<div>
|
|
|
|
{ /* Prefetch using the declarative API */ }
|
|
|
|
<Link href='/'>
|
2016-12-20 20:44:23 +00:00
|
|
|
<a>Home</a>
|
2016-12-15 19:13:40 +00:00
|
|
|
</Link>
|
|
|
|
|
|
|
|
<Link href='/features'>
|
2016-12-20 20:44:23 +00:00
|
|
|
<a>Features</a>
|
2016-12-15 19:13:40 +00:00
|
|
|
</Link>
|
|
|
|
|
2016-12-20 20:44:23 +00:00
|
|
|
{ /* we imperatively prefetch on hover */ }
|
|
|
|
<RegularLink href='/about'>
|
|
|
|
<a onMouseEnter={ () => prefetch('/about') && console.log('prefetching /about!') }>About</a>
|
|
|
|
</RegularLink>
|
2016-12-15 19:13:40 +00:00
|
|
|
|
|
|
|
<Link href='/contact' prefetch={false}>
|
2016-12-20 20:44:23 +00:00
|
|
|
<a>Contact (<small>NO-PREFETCHING</small>)</a>
|
2016-12-15 19:13:40 +00:00
|
|
|
</Link>
|
2016-12-20 20:44:23 +00:00
|
|
|
|
|
|
|
<style jsx>{`
|
|
|
|
a {
|
|
|
|
margin-right: 10px;
|
|
|
|
}
|
|
|
|
`}</style>
|
2016-12-15 19:13:40 +00:00
|
|
|
</div>
|
|
|
|
)
|