Commit 9056116c authored by Guillermo Rauch's avatar Guillermo Rauch Committed by GitHub

Update Header.js

parent 37666125
import React from 'react'
import Link, { prefetch } from 'next/prefetch' import Link, { prefetch } from 'next/prefetch'
import RegularLink from 'next/link'
// Prefetch using the imperative API
prefetch('/')
const styles = {
a: {
marginRight: 10
}
}
export default () => ( export default () => (
<div> <div>
{ /* Prefetch using the declarative API */ } { /* Prefetch using the declarative API */ }
<Link href='/'> <Link href='/'>
<a style={styles.a} >Home</a> <a>Home</a>
</Link> </Link>
<Link href='/features'> <Link href='/features'>
<a style={styles.a} >Features</a> <a>Features</a>
</Link> </Link>
<Link href='/about'> { /* we imperatively prefetch on hover */ }
<a style={styles.a} >About</a> <RegularLink href='/about'>
</Link> <a onMouseEnter={ () => prefetch('/about') && console.log('prefetching /about!') }>About</a>
</RegularLink>
<Link href='/contact' prefetch={false}> <Link href='/contact' prefetch={false}>
<a style={styles.a} >Contact (<small>NO-PREFETCHING</small>)</a> <a>Contact (<small>NO-PREFETCHING</small>)</a>
</Link> </Link>
<style jsx>{`
a {
margin-right: 10px;
}
`}</style>
</div> </div>
) )
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