import React from 'react' import Document, { Head, Main, NextScript } from 'next/document' import { getContext, setContext } from '../styles/context' export default class MyDocument extends Document { static async getInitialProps (ctx) { // Reset the context for handling a new request. setContext() const page = ctx.renderPage() // Get the context with the collected side effects. const context = getContext() return { ...page, styles: } } render () { const context = getContext() return (