New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Your thoughts about CSS in JavaScript? #560

Closed
gothbarbie opened this Issue Jan 28, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@gothbarbie
Copy link

gothbarbie commented Jan 28, 2019

I've come to really enjoy working with styled-components.

I know some people feel that CSS and JavaScript should be separated, but since we're already writing HTML with JSX, why not use the flexibility of JavaScript when we write our CSS as well?

Have you tried any CSS-in-JavaScript tool and what are your thoughts about it? Any obvious drawbacks that you see? Or is it more a matter of familiarity and personal taste?

What I personally enjoy is that you can keep the camel-case style of CSS while having the flexibility of using props for different scenarios, as well as easily expand upon existing styles for when you need variations:

const Button = styled.button`
  background-color: #ccc; 
  // other default styling
`
const BlueButton = styled(Button)`
  background-color: #00F;
`

@joeycozza joeycozza added the packages label Jan 28, 2019

@kentcdodds

This comment has been minimized.

Copy link
Owner

kentcdodds commented Jan 28, 2019

Hi @gothbarbie!

Thanks for the question. Here's your answer: https://www.briefs.fm/3-minutes-with-kent/80

And here's the YouTube video I referenced: https://www.youtube.com/watch?v=R1_nGU0x3Wk&list=PLV5CVI1eNcJgNqzNwcs4UKrlJdhfDjshf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment