1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-typestyle/pages/_document.js
Sahal Sajjad 136585e296 Added example: with-typestyle (#4926)
* Added example: with-typestyle

* Fixed bug: Rendering the DOM tree twice
2018-08-08 21:36:34 -07:00

28 lines
596 B
JavaScript

import Document, { Head, Main, NextScript } from 'next/document'
import {getStyles} from 'typestyle'
export default class MyDocument extends Document {
static getInitialProps ({ renderPage }) {
const page = renderPage()
const styleTags = getStyles()
return { ...page, styleTags }
}
render () {
return (
<html>
<Head>
<title>My page</title>
<style id='styles-target'>
{this.props.styleTags}
</style>
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
)
}
}