import Document, { Head, Main, NextScript } from 'next/document' import { ServerStyleSheet } from 'styled-components' export default class MyDocument extends Document { render () { const sheet = new ServerStyleSheet() const main = sheet.collectStyles(
) const styleTags = sheet.getStyleElement() return ( My page {styleTags}
{main}
) } }