1
0
Fork 0
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:
Guillermo Rauch 2016-12-19 14:25:03 -08:00 committed by GitHub
parent 3c25bef2ea
commit 1980726208

View file

@ -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>