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 {
|
||||
static async getInitialProps (ctx) {
|
||||
const props = await Document.getInitialProps(ctx)
|
||||
// append a custom `value`
|
||||
return { ...props, value: 'hi' }
|
||||
return { ...props, customValue: 'hi there!' }
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<html>
|
||||
<Head>
|
||||
{/* custom style */}
|
||||
<style>{`body { margin: 0 }`}</style>
|
||||
<style>{`body { margin: 0 } /* custom! */`}</style>
|
||||
</Head>
|
||||
{/* set className to body */}
|
||||
<body className="hi">
|
||||
{this.props.value}
|
||||
<body className="custom_class">
|
||||
{this.props.customValue}
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue