Created
February 14, 2018 00:07
-
-
Save SaraVieira/b7468b94bb54e5ee1824b3a0a1bcc0f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import App from './components/app'; | |
import { h, render } from 'preact'; | |
import { default as renderToString } from 'preact-render-to-string'; | |
import { ServerStyleSheet } from 'styled-components' | |
if(typeof window === undefined) { | |
const sheet = new ServerStyleSheet() | |
const html = renderToString(sheet.collectStyles(<App />)) | |
const styleTags = sheet.getStyleTags() // or sheet.getStyleElement() | |
} | |
if (typeof window !== "undefined") { | |
render(( | |
<App /> | |
), document.getElementById('root')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment