mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
update with-prefetching example (#4850)
This commit is contained in:
parent
283e9afe70
commit
88610694c2
25
examples/with-prefetching/pages/_app.js
Normal file
25
examples/with-prefetching/pages/_app.js
Normal file
|
@ -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 (
|
||||
<Container>
|
||||
<Header />
|
||||
<Component {...pageProps} />
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,8 +1 @@
|
|||
import Header from '../components/Header'
|
||||
|
||||
export default () => (
|
||||
<div>
|
||||
<Header />
|
||||
<p>This is the ABOUT page.</p>
|
||||
</div>
|
||||
)
|
||||
export default () => <p>This is the ABOUT page.</p>
|
||||
|
|
|
@ -1,8 +1 @@
|
|||
import Header from '../components/Header'
|
||||
|
||||
export default () => (
|
||||
<div>
|
||||
<Header />
|
||||
<p>This is the CONTACT page.</p>
|
||||
</div>
|
||||
)
|
||||
export default () => <p>This is the CONTACT page.</p>
|
||||
|
|
|
@ -1,8 +1 @@
|
|||
import Header from '../components/Header'
|
||||
|
||||
export default () => (
|
||||
<div>
|
||||
<Header />
|
||||
<p>This is the FEATURES page.</p>
|
||||
</div>
|
||||
)
|
||||
export default () => <p>This is the FEATURES page.</p>
|
||||
|
|
|
@ -1,8 +1 @@
|
|||
import Header from '../components/Header'
|
||||
|
||||
export default () => (
|
||||
<div>
|
||||
<Header />
|
||||
<p>This is the HOME page</p>
|
||||
</div>
|
||||
)
|
||||
export default () => <p>This is the HOME page</p>
|
||||
|
|
Loading…
Reference in a new issue