Skip to content

Instantly share code, notes, and snippets.

@brookslybrand
Created October 5, 2020 21:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brookslybrand/10113016f609a3f5a562cdfbb56f66bc to your computer and use it in GitHub Desktop.
Save brookslybrand/10113016f609a3f5a562cdfbb56f66bc to your computer and use it in GitHub Desktop.
// styled component version
const Container = styled.div`
/*all of the styles*/
`
function MyComponent() {
return <Container>{/*other stuff*/}</Container>
}
// css prop version
function MyComponent() {
return (
<div css={css`
/*all of the styles*/
`}>
{/*other stuff*/}
</div>
)
}
// if you really want you can move the css declaration below or in a different file
function MyComponent() {
return (
<div css={containerCss}>
{/*other stuff*/}
</div>
)
}
const containerCss = css`
/*all of the styles*/
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment