mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Update README.md
This commit is contained in:
parent
3c25bef2ea
commit
1980726208
11
README.md
11
README.md
|
@ -286,20 +286,17 @@ import Document, { Head, Main, NextScript } from `next/document`
|
||||||
export default class MyDocument extends Document {
|
export default class MyDocument extends Document {
|
||||||
static async getInitialProps (ctx) {
|
static async getInitialProps (ctx) {
|
||||||
const props = await Document.getInitialProps(ctx)
|
const props = await Document.getInitialProps(ctx)
|
||||||
// append a custom `value`
|
return { ...props, customValue: 'hi there!' }
|
||||||
return { ...props, value: 'hi' }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<html>
|
<html>
|
||||||
<Head>
|
<Head>
|
||||||
{/* custom style */}
|
<style>{`body { margin: 0 } /* custom! */`}</style>
|
||||||
<style>{`body { margin: 0 }`}</style>
|
|
||||||
</Head>
|
</Head>
|
||||||
{/* set className to body */}
|
<body className="custom_class">
|
||||||
<body className="hi">
|
{this.props.customValue}
|
||||||
{this.props.value}
|
|
||||||
<Main />
|
<Main />
|
||||||
<NextScript />
|
<NextScript />
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue