Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Your thoughts about CSS in JavaScript? #560

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

Your thoughts about CSS in JavaScript? #560

hannasdev opened this issue Jan 28, 2019 · 1 comment
Labels
audio-answer Answers provided as an audio clip packages Thoughts/opinions/personal use of 3rd party packages/libraries/frameworks

Comments

@hannasdev
Copy link

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 Thoughts/opinions/personal use of 3rd party packages/libraries/frameworks label Jan 28, 2019
@kentcdodds
Copy link
Owner

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

@kentcdodds kentcdodds added the audio-answer Answers provided as an audio clip label Jan 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
audio-answer Answers provided as an audio clip packages Thoughts/opinions/personal use of 3rd party packages/libraries/frameworks
Projects
None yet
Development

No branches or pull requests

3 participants