Skip to content

Instantly share code, notes, and snippets.

@sht5
Created December 8, 2018 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sht5/90d3c82fe3ca99bc6ffc1d3f2dbf6657 to your computer and use it in GitHub Desktop.
Save sht5/90d3c82fe3ca99bc6ffc1d3f2dbf6657 to your computer and use it in GitHub Desktop.
*these are simple examples from EmotionJS docs
//example passing object to css prop
import { jsx } from '@emotion/core'
render(
<div
css={{
backgroundColor: 'hotpink',
'&:hover': {
color: 'lightgreen'
}
}}
>
This has a hotpink background.
</div>
)
//example passing a string to the css prop
import { css, jsx } from '@emotion/core'
const color = 'darkgreen'
render(
<div
css={css`
background-color: hotpink;
&:hover {
color: ${color};
}
`}
>
This has a hotpink background.
</div>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment