From 88610694c239bcd7f4d7fa4a684c0cf5246456a5 Mon Sep 17 00:00:00 2001 From: Tomek Date: Fri, 27 Jul 2018 22:08:09 +0200 Subject: [PATCH] update with-prefetching example (#4850) --- examples/with-prefetching/pages/_app.js | 25 +++++++++++++++++++++ examples/with-prefetching/pages/about.js | 9 +------- examples/with-prefetching/pages/contact.js | 9 +------- examples/with-prefetching/pages/features.js | 9 +------- examples/with-prefetching/pages/index.js | 9 +------- 5 files changed, 29 insertions(+), 32 deletions(-) create mode 100644 examples/with-prefetching/pages/_app.js diff --git a/examples/with-prefetching/pages/_app.js b/examples/with-prefetching/pages/_app.js new file mode 100644 index 0000000000000..0ac4d7bd95281 --- /dev/null +++ b/examples/with-prefetching/pages/_app.js @@ -0,0 +1,25 @@ +import App, {Container} from 'next/app' +import React from 'react' +import Header from '../components/Header' + +export default class MyApp extends App { + static async getInitialProps ({ Component, router, ctx }) { + let pageProps = {} + + if (Component.getInitialProps) { + pageProps = await Component.getInitialProps(ctx) + } + + return {pageProps} + } + + render () { + const {Component, pageProps} = this.props + return ( + +
+ + + ) + } +} diff --git a/examples/with-prefetching/pages/about.js b/examples/with-prefetching/pages/about.js index 8a9a0736f0003..ae26598fb784b 100644 --- a/examples/with-prefetching/pages/about.js +++ b/examples/with-prefetching/pages/about.js @@ -1,8 +1 @@ -import Header from '../components/Header' - -export default () => ( -
-
-

This is the ABOUT page.

-
-) +export default () =>

This is the ABOUT page.

diff --git a/examples/with-prefetching/pages/contact.js b/examples/with-prefetching/pages/contact.js index 912fd57313d43..2932f6cbd8b55 100644 --- a/examples/with-prefetching/pages/contact.js +++ b/examples/with-prefetching/pages/contact.js @@ -1,8 +1 @@ -import Header from '../components/Header' - -export default () => ( -
-
-

This is the CONTACT page.

-
-) +export default () =>

This is the CONTACT page.

diff --git a/examples/with-prefetching/pages/features.js b/examples/with-prefetching/pages/features.js index ee90469e2bd99..dc59e799c9f7d 100644 --- a/examples/with-prefetching/pages/features.js +++ b/examples/with-prefetching/pages/features.js @@ -1,8 +1 @@ -import Header from '../components/Header' - -export default () => ( -
-
-

This is the FEATURES page.

-
-) +export default () =>

This is the FEATURES page.

diff --git a/examples/with-prefetching/pages/index.js b/examples/with-prefetching/pages/index.js index 10fa50b167a84..b2c6ebfcd4725 100644 --- a/examples/with-prefetching/pages/index.js +++ b/examples/with-prefetching/pages/index.js @@ -1,8 +1 @@ -import Header from '../components/Header' - -export default () => ( -
-
-

This is the HOME page

-
-) +export default () =>

This is the HOME page