rsnext/examples/with-prefetching/components/Header.js
Tim Neutkens 9c4eefcdbf
Add prettier for examples directory (#5909)
* Add prettier for examples directory

* Fix files

* Fix linting

* Add prettier script in case it has to be ran again
2018-12-17 17:34:32 +01:00

39 lines
720 B
JavaScript

import Router from 'next/router'
import Link from 'next/link'
export default () => (
<div>
{/* Prefetch using the declarative API */}
<Link prefetch href='/'>
<a>Home</a>
</Link>
<Link prefetch href='/features'>
<a>Features</a>
</Link>
{/* we imperatively prefetch on hover */}
<Link href='/about'>
<a
onMouseEnter={() => {
Router.prefetch('/about')
console.log('prefetching /about!')
}}
>
About
</a>
</Link>
<Link href='/contact'>
<a>
Contact (<small>NO-PREFETCHING</small>)
</a>
</Link>
<style jsx>{`
a {
margin-right: 10px;
}
`}</style>
</div>
)