Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Created June 4, 2018 17:09
Show Gist options
  • Save SaraVieira/6c0de5305873e019f7d5c51c6c963988 to your computer and use it in GitHub Desktop.
Save SaraVieira/6c0de5305873e019f7d5c51c6c963988 to your computer and use it in GitHub Desktop.
import { ServerStyleSheet, ThemeProvider } from 'styled-components'
const sheet = new ServerStyleSheet()
// When the app is rendered collect the styles that are used inside it
const markup = renderToString(sheet.collectStyles(<Root />))
// Generate all the style tags so they can be rendered into the page
const styleTags = sheet.getStyleTags()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment