mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
25 lines
666 B
JavaScript
25 lines
666 B
JavaScript
|
import Document, { Head, Main, NextScript } from 'next/document'
|
||
|
|
||
|
export default class MyDocument extends Document {
|
||
|
static async getInitialProps (ctx) {
|
||
|
const initialProps = await Document.getInitialProps(ctx)
|
||
|
return { ...initialProps, customProperty: 'Hello Document' }
|
||
|
}
|
||
|
|
||
|
render () {
|
||
|
return (
|
||
|
<html>
|
||
|
<Head>
|
||
|
<style>{`body { margin: 0 } /* custom! */`}</style>
|
||
|
</Head>
|
||
|
<body className='custom_class'>
|
||
|
<p id='custom-property'>{this.props.customProperty}</p>
|
||
|
<p id='document-hmr'>Hello Document HMR</p>
|
||
|
<Main />
|
||
|
<NextScript />
|
||
|
</body>
|
||
|
</html>
|
||
|
)
|
||
|
}
|
||
|
}
|