diff --git a/examples/with-emotion-11/pages/_document.js b/examples/with-emotion-11/pages/_document.js index 19c14db0a7e01..09fb820698805 100644 --- a/examples/with-emotion-11/pages/_document.js +++ b/examples/with-emotion-11/pages/_document.js @@ -2,21 +2,27 @@ import Document, { Head, Main, NextScript } from 'next/document' import { extractCritical } from '@emotion/server' export default class MyDocument extends Document { - static getInitialProps({ renderPage }) { - const page = renderPage() - const styles = extractCritical(page.html) - return { ...page, ...styles } + static async getInitialProps(ctx) { + const initialProps = await Document.getInitialProps(ctx) + const styles = extractCritical(initialProps.html) + return { + ...initialProps, + styles: ( + <> + {initialProps.styles} +