Skip to content

Instantly share code, notes, and snippets.

@yungblud
Created June 7, 2019 08:22
Show Gist options
  • Select an option

  • Save yungblud/f26069e1d12b5d8fda9b42d610bae23a to your computer and use it in GitHub Desktop.

Select an option

Save yungblud/f26069e1d12b5d8fda9b42d610bae23a to your computer and use it in GitHub Desktop.

createGlobalStyle

import { createGlobalStyle } from 'styled-components'

const GlobalStyle = createGlobalStyle`
  body {
    color: ${props => (props.whiteColor ? 'white' : 'black')};
  }
`

// later in your app

<React.Fragment>
  <GlobalStyle whiteColor />
  <Navigation /> {/* example of other top-level stuff */}
</React.Fragment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment