Buckets:
| import Document from 'next/document' | |
| import { ServerStyleSheet } from 'styled-components' | |
| export default class MyDocument extends Document { | |
| static async getInitialProps(ctx) { | |
| const sheet = new ServerStyleSheet() | |
| const originalRenderPage = ctx.renderPage | |
| try { | |
| ctx.renderPage = () => | |
| originalRenderPage({ | |
| enhanceApp: (App) => (props) => | |
| sheet.collectStyles(<App {...props} />), | |
| }) | |
| const initialProps = await Document.getInitialProps(ctx) | |
| return { | |
| ...initialProps, | |
| styles: ( | |
| <> | |
| {initialProps.styles} | |
| {sheet.getStyleElement()} | |
| </> | |
| ), | |
| } | |
| } finally { | |
| sheet.seal() | |
| } | |
| } | |
| } | |
Xet Storage Details
- Size:
- 729 Bytes
- Xet hash:
- 372249ee2c210c8c035a63a129d0a93e703c646215f3aef4b57619d7bbe883b2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.