mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
9300151118
Co-authored-by: JJ Kasper <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
26 lines
548 B
React
26 lines
548 B
React
import Document, { Html, Head, Main, NextScript } from 'next/document'
|
|
|
|
const docValue = await Promise.resolve('doc value')
|
|
|
|
class MyDocument extends Document {
|
|
static async getInitialProps(ctx) {
|
|
const initialProps = await Document.getInitialProps(ctx)
|
|
return { ...initialProps, docValue }
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Html>
|
|
<Head />
|
|
<body>
|
|
<div id="doc-value">{this.props.docValue}</div>
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default MyDocument
|