Why I Write CSS in JavaScript
mxstbr.com
Why I Write CSS in JavaScript
1–10 of 255 posts
Re: Why I Write CSS in JavaScript
#2Re: Why I Write CSS in JavaScript
#3Author here, happy to respond to any questions. AMA!
Re: Why I Write CSS in JavaScript
#4Author here, happy to respond to any questions. AMA!
- In your react example, I see you created as styled.h1, but that's an awkward way of bootstrapping a component. Even if I used SC, I would still put the style information outside my component code in the same directory. At this point I don't see the benefit over doing something like:
import * from './login.scss';
What can SC do that regular CSS or SASS can't?Re: Why I Write CSS in JavaScript
#5Re: Why I Write CSS in JavaScript
#6Author here, happy to respond to any questions. AMA!
How do you plan to accommodate NoScript users?
If you do not server-side render, it does not matter whether you put your CSS into JavaScript or not—your JavaScript app is not going to render anything anyway.
Re: Why I Write CSS in JavaScript
#7Author here, happy to respond to any questions. AMA!
How do you plan to accommodate NoScript users?
Re: Why I Write CSS in JavaScript
#8Author here, happy to respond to any questions. AMA!
- Were there moments when you cried back SASS or vanilla CSS? - In your react example, I see you created as styled.h1, but that's an awkward way of bootstrapping a component. Even if I used SC, I would still put the style information outside my component code in the same directory. At this point I don't see the benefit over doing something like: import * from './login.scss'; What can SC do that regular CSS or SASS ca…
Re: Why I Write CSS in JavaScript
#9Look at this beauty for comparison: https://vuejs.org/v2/guide/single-file-components.html
Re: Why I Write CSS in JavaScript
#10Author here, happy to respond to any questions. AMA!
- Were there moments when you cried back SASS or vanilla CSS? - In your react example, I see you created as styled.h1, but that's an awkward way of bootstrapping a component. Even if I used SC, I would still put the style information outside my component code in the same directory. At this point I don't see the benefit over doing something like: import * from './login.scss'; What can SC do that regular CSS or SASS ca…
- This ties into a broader point of having "style components" like and , which is a very nice way of working in React. styled-components (the library) simply takes that pattern and enforces it across your application. See style-components.com for links to some more resources about this pattern!