From 6874530572024ff755fc0a3690bd76ebaa368b1e Mon Sep 17 00:00:00 2001 From: looskie <50378828+Looskie@users.noreply.github.com> Date: Sat, 26 Jun 2021 12:21:47 -0400 Subject: [PATCH] Refactoring: Remove documentJS --- pages/_document.js | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 pages/_document.js diff --git a/pages/_document.js b/pages/_document.js deleted file mode 100644 index f967ac0..0000000 --- a/pages/_document.js +++ /dev/null @@ -1,29 +0,0 @@ -import Document from "next/document"; -import { ServerStyleSheet } from "styled-components"; - -export default class MyDocument extends Document { - static async getInitialProps(ctx) { - const sheet = new ServerStyleSheet(), - originalRenderPage = ctx.renderPage; - - try { - ctx.renderPage = () => - originalRenderPage({ - enhanceApp: App => props => sheet.collectStyles(), - }); - - const initialProps = await Document.getInitialProps(ctx); - return { - ...initialProps, - styles: ( - <> - {initialProps.styles} - {sheet.getStyleElement()} - - ), - }; - } finally { - sheet.seal(); - } - } -}