From e9543cf6145c09113058877c2eb240dca20945d8 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sat, 17 Dec 2016 11:48:52 -0800 Subject: [PATCH] Update README.md --- README.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4ca1531f..cadddb53 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ and add a script to your package.json like this: { "scripts": { "dev": "next" - } + } } ``` @@ -214,16 +214,14 @@ Most needs are addressed by ``, but we also expose an imperative API for ```jsx import { prefetch } from 'next/prefetch' -prefetch('/') -prefetch('/features') -``` - -Note: it's also possible to prefetch by using an empty ``: - -```js -import Link from 'next/prefetch' -export default () => ( -
Hello world
+export default ({ url }) => ( + setTimeout(() => url.pushTo('/dynamic'), 100) }> + A route transition will happen after 100ms + + { + // but we can prefetch it! + prefetch('/dynamic') + } ) ``` @@ -233,7 +231,6 @@ export default () => ( ```jsx import React from 'react' - export default class Error extends React.Component { static getInitialProps ({ res, xhr }) { const statusCode = res ? res.statusCode : (xhr ? xhr.status : null)