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