weddingsite/pages/_document.js

26 lines
623 B
JavaScript
Raw Permalink Normal View History

2021-06-04 00:58:40 +00:00
import Document, { Html, Head, NextScript, Main } 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} />)
2021-06-04 00:58:40 +00:00
);
const styleTags = sheet.getStyleElement();
return { ...page, styleTags };
}
render() {
return (
<Html lang="en-US">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}