1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-prefetching/components/Header.js

33 lines
620 B
JavaScript
Raw Normal View History

import React from 'react'
import Link, { prefetch } from 'next/prefetch'
// Prefetch using the imperative API
prefetch('/')
const styles = {
a: {
marginRight: 10
}
}
export default () => (
<div>
{ /* Prefetch using the declarative API */ }
<Link href='/'>
<a style={styles.a} >Home</a>
</Link>
<Link href='/features'>
<a style={styles.a} >Features</a>
</Link>
<Link href='/about'>
<a style={styles.a} >About</a>
</Link>
<Link href='/contact' prefetch={false}>
<a style={styles.a} >Contact (<small>NO-PREFETCHING</small>)</a>
</Link>
</div>
)