3 ms·
> There’s something huge to be said about the fact that I don’t need to context switch to CSS-land out of my markup to style up what I’m doing. I didn’t realise
by Swizec 6y ago
> There’s something huge to be said about the fact that I don’t need to context switch to CSS-land out of my markup to style up what I’m doing. I didn’t realise it, but that overhead of switching to a style sheet and going back to modify markup and then viewing the results in the browser really just used up my mental energy battery.
Welcome to what us React folk have been saying since at least 2016. Splitting your code by language is bad. Vertical slices for the win.
- benatkin 6y agoAgree. Vue and Svelte get this right as well (assuming you use SFCs properly), except they don't have bizarre preferences for one-way data binding everywhere or typing className instead of class.
- runarberg 6y agoAgree with this. Although I’m gonna say it is not the single file per-se which is the winning technology here but the component scoped styles. When writing vanilla web components this can be accomplished with `this.attachShadow()`, and in Stencil you write an external stylesheet and reference it with a `styleUrl` in your `@Component` decorator. In fact it is kind of nice to put your styles in another file if you have a designer on your team who is afraid to touch any files that don’t have the `.css` extension.
- aabbcc1241 6y agoElm also approaches this way, with type-safe checking.
- tiborsaas 6y agoI still dislike CSS in JS solutions and classname soup. - A fellow React folk.