Skip to content

Commit 6ede206

Browse files
seduboistimneutkens
authored andcommitted
update link prefetch syntax in examples (vercel#1276)
1 parent e24db68 commit 6ede206

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

examples/data-fetch/pages/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import React from 'react'
3-
import Link from 'next/prefetch'
3+
import Link from 'next/link'
44
import 'isomorphic-fetch'
55

66
export default class MyPage extends React.Component {
@@ -15,7 +15,7 @@ export default class MyPage extends React.Component {
1515
return (
1616
<div>
1717
<p>Next.js has {this.props.stars} ⭐️</p>
18-
<Link href='/preact'><a>How about preact?</a></Link>
18+
<Link prefetch href='/preact'><a>How about preact?</a></Link>
1919
</div>
2020
)
2121
}

examples/data-fetch/pages/preact.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import React from 'react'
3-
import Link from 'next/prefetch'
3+
import Link from 'next/link'
44
import 'isomorphic-fetch'
55

66
export default class MyPage extends React.Component {
@@ -15,7 +15,7 @@ export default class MyPage extends React.Component {
1515
return (
1616
<div>
1717
<p>Preact has {this.props.stars} ⭐️</p>
18-
<Link href='/'><a>I bet next has more stars (?)</a></Link>
18+
<Link prefetch href='/'><a>I bet next has more stars (?)</a></Link>
1919
</div>
2020
)
2121
}

examples/using-inferno/pages/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
2-
import Link from 'next/prefetch'
2+
import Link from 'next/link'
33

44
export default () => (
5-
<div>Hello World. <Link href='/about'><a>About</a></Link></div>
5+
<div>Hello World. <Link prefetch href='/about'><a>About</a></Link></div>
66
)

examples/with-apollo/components/Header.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import Link from 'next/prefetch'
1+
import Link from 'next/link'
22

33
export default ({ pathname }) => (
44
<header>
5-
<Link href='/'>
5+
<Link prefetch href='/'>
66
<a className={pathname === '/' && 'is-active'}>Home</a>
77
</Link>
88

9-
<Link href='/about'>
9+
<Link prefetch href='/about'>
1010
<a className={pathname === '/about' && 'is-active'}>About</a>
1111
</Link>
1212

examples/with-flow/types/next.js.flow

-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ declare module "next/error" {
2424
declare module.exports: Class<React$Component<void, {statusCode: number}, any>>;
2525
}
2626

27-
declare module "next/prefetch" {
28-
declare export var prefetch: (url: string) => any;
29-
declare export var reloadIfPrefetched: any;
30-
declare export default Class<React$Component<void, {href: string, prefetch?: boolean}, any>>;
31-
}
32-
3327
declare module "next/router" {
3428
declare module.exports: {
3529
route: string;

0 commit comments

Comments
 (0)