Skip to content
This repository has been archived by the owner. It is now read-only.

Your thoughts about CSS in JavaScript? #560

Closed
hannasoderstromdev opened this issue Jan 28, 2019 · 1 comment
Closed

Your thoughts about CSS in JavaScript? #560

hannasoderstromdev opened this issue Jan 28, 2019 · 1 comment

Comments

@hannasoderstromdev
Copy link

@hannasoderstromdev hannasoderstromdev 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;
`
@kentcdodds
Copy link
Owner

@kentcdodds 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants