mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
update link prefetch syntax in examples (#1276)
This commit is contained in:
parent
e24db68f8b
commit
6ede206d82
|
@ -1,6 +1,6 @@
|
|||
|
||||
import React from 'react'
|
||||
import Link from 'next/prefetch'
|
||||
import Link from 'next/link'
|
||||
import 'isomorphic-fetch'
|
||||
|
||||
export default class MyPage extends React.Component {
|
||||
|
@ -15,7 +15,7 @@ export default class MyPage extends React.Component {
|
|||
return (
|
||||
<div>
|
||||
<p>Next.js has {this.props.stars} ⭐️</p>
|
||||
<Link href='/preact'><a>How about preact?</a></Link>
|
||||
<Link prefetch href='/preact'><a>How about preact?</a></Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import React from 'react'
|
||||
import Link from 'next/prefetch'
|
||||
import Link from 'next/link'
|
||||
import 'isomorphic-fetch'
|
||||
|
||||
export default class MyPage extends React.Component {
|
||||
|
@ -15,7 +15,7 @@ export default class MyPage extends React.Component {
|
|||
return (
|
||||
<div>
|
||||
<p>Preact has {this.props.stars} ⭐️</p>
|
||||
<Link href='/'><a>I bet next has more stars (?)</a></Link>
|
||||
<Link prefetch href='/'><a>I bet next has more stars (?)</a></Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react'
|
||||
import Link from 'next/prefetch'
|
||||
import Link from 'next/link'
|
||||
|
||||
export default () => (
|
||||
<div>Hello World. <Link href='/about'><a>About</a></Link></div>
|
||||
<div>Hello World. <Link prefetch href='/about'><a>About</a></Link></div>
|
||||
)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import Link from 'next/prefetch'
|
||||
import Link from 'next/link'
|
||||
|
||||
export default ({ pathname }) => (
|
||||
<header>
|
||||
<Link href='/'>
|
||||
<Link prefetch href='/'>
|
||||
<a className={pathname === '/' && 'is-active'}>Home</a>
|
||||
</Link>
|
||||
|
||||
<Link href='/about'>
|
||||
<Link prefetch href='/about'>
|
||||
<a className={pathname === '/about' && 'is-active'}>About</a>
|
||||
</Link>
|
||||
|
||||
|
|
|
@ -24,12 +24,6 @@ declare module "next/error" {
|
|||
declare module.exports: Class<React$Component<void, {statusCode: number}, any>>;
|
||||
}
|
||||
|
||||
declare module "next/prefetch" {
|
||||
declare export var prefetch: (url: string) => any;
|
||||
declare export var reloadIfPrefetched: any;
|
||||
declare export default Class<React$Component<void, {href: string, prefetch?: boolean}, any>>;
|
||||
}
|
||||
|
||||
declare module "next/router" {
|
||||
declare module.exports: {
|
||||
route: string;
|
||||
|
|
Loading…
Reference in a new issue