1
0
Fork 0
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:
Sébastien Dubois 2017-02-25 16:54:42 +02:00 committed by Tim Neutkens
parent e24db68f8b
commit 6ede206d82
5 changed files with 9 additions and 15 deletions

View file

@ -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>
)
}

View file

@ -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>
)
}

View file

@ -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>
)

View file

@ -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>

View file

@ -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;