From 8f2c595eca30e2d7138c8e8d6685774a8f44e55d Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 15 Feb 2018 16:59:58 -0500 Subject: omg --- frontend/pages/_document.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 frontend/pages/_document.js (limited to 'frontend/pages/_document.js') 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()); + const styleTags = sheet.getStyleElement(); + return { ...page, styleTags }; + } + + render() { + return ( + + + My page + {this.props.styleTags} + + +
+ + + + ); + } +} -- cgit v1.3