Created
December 8, 2018 20:00
-
-
Save sht5/90d3c82fe3ca99bc6ffc1d3f2dbf6657 to your computer and use it in GitHub Desktop.
This file contains 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
*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