diff options
Diffstat (limited to 'frontend/pages/_document.js')
| -rw-r--r-- | frontend/pages/_document.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/frontend/pages/_document.js b/frontend/pages/_document.js new file mode 100644 index 0000000..e9a6570 --- /dev/null +++ b/frontend/pages/_document.js @@ -0,0 +1,26 @@ +import Document, { Head, Main, NextScript } from 'next/document'; +import { ServerStyleSheet } from 'styled-components'; + +export default class MyDocument extends Document { + static getInitialProps({ renderPage }) { + const sheet = new ServerStyleSheet(); + const page = renderPage(App => props => sheet.collectStyles(<App {...props} />)); + const styleTags = sheet.getStyleElement(); + return { ...page, styleTags }; + } + + render() { + return ( + <html> + <Head> + <title>My page</title> + {this.props.styleTags} + </Head> + <body> + <Main /> + <NextScript /> + </body> + </html> + ); + } +} |
