2017-02-15 08:52:22 +00:00
|
|
|
import Router from 'next/router'
|
|
|
|
import Link from 'next/link'
|
2016-12-15 19:13:40 +00:00
|
|
|
|
|
|
|
export default () => (
|
|
|
|
<div>
|
2018-12-17 16:34:32 +00:00
|
|
|
{/* Prefetch using the declarative API */}
|
2017-02-15 08:52:22 +00:00
|
|
|
<Link prefetch href='/'>
|
2016-12-20 20:44:23 +00:00
|
|
|
<a>Home</a>
|
2016-12-15 19:13:40 +00:00
|
|
|
</Link>
|
|
|
|
|
2017-02-15 08:52:22 +00:00
|
|
|
<Link prefetch href='/features'>
|
2016-12-20 20:44:23 +00:00
|
|
|
<a>Features</a>
|
2016-12-15 19:13:40 +00:00
|
|
|
</Link>
|
|
|
|
|
2018-12-17 16:34:32 +00:00
|
|
|
{/* we imperatively prefetch on hover */}
|
2017-02-15 08:52:22 +00:00
|
|
|
<Link href='/about'>
|
2018-12-17 16:34:32 +00:00
|
|
|
<a
|
|
|
|
onMouseEnter={() => {
|
|
|
|
Router.prefetch('/about')
|
|
|
|
console.log('prefetching /about!')
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
About
|
|
|
|
</a>
|
2017-02-15 08:52:22 +00:00
|
|
|
</Link>
|
2016-12-15 19:13:40 +00:00
|
|
|
|
2017-02-15 08:52:22 +00:00
|
|
|
<Link href='/contact'>
|
2018-12-17 16:34:32 +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>
|
|
|
|
)
|