mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix styled-components server-render example (#1382)
This commit is contained in:
parent
6db7101c40
commit
bb3ceaadea
|
@ -4,7 +4,9 @@ import styleSheet from 'styled-components/lib/models/StyleSheet'
|
|||
export default class MyDocument extends Document {
|
||||
static async getInitialProps ({ renderPage }) {
|
||||
const page = renderPage()
|
||||
const styles = styleSheet.rules().map(rule => rule.cssText).join('\n')
|
||||
const styles = (
|
||||
<style dangerouslySetInnerHTML={{ __html: styleSheet.rules().map(rule => rule.cssText).join('\n') }} />
|
||||
)
|
||||
return { ...page, styles }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue