import React from 'react' import Document, {Main, NextScript} from 'next/document' import {ServerStyleSheet} from 'styled-components' import {extractCritical} from 'emotion-server' import {config, getAssetPath} from '../src/utils' export default class MyDocument extends Document { static getInitialProps({renderPage}) { const sheet = new ServerStyleSheet() const page = renderPage(App => props => sheet.collectStyles()) return { ...page, styleTags: ( <> {sheet.getStyleElement()} ) } } render() { const {styleTags} = this.props return ( Primer Components