![]() Laura buns has a wonderfully two-sided article titled “The web without the web” part of which is about React and CSS-in-JS: I already know how to scope CSS.” I find that stuff to be more poking across the isles that isn’t particularly helpful. I’ve heard lots of pushback on CSS-in-JS in the vein of “you people are reaching for CSS-in-JS because you don’t understand CSS” or “You’re doing this because you’re afraid of the cascade. What does CSS-in-JS not rid you of needing to understand:ĬSS-in-JS doesn’t absolve you of learning CSS. Take advantage of anything from the JS ecosystem.Take advantage of native JS syntax features.Let you author CSS in JavaScript syntax.( Here’s a video on CSS-in-JS I did with Dustin Schau if you need a primer.)īrent Jackson thinks you should definitely learn it, but also offers some pragmatic points on what it does and doesn’t do: Vue’s single file components are an archetype here. The co-location of templates and functionality, à la most JavaScript frameworks, has proven successful to them, so wrapping in styles seems like a natural fit. Some people outright love the idea of CSS-in-JS. Anything else is a laughable misstep, a sign of not learning from the mistakes of the past (like the tag and such.) Styling doesn’t belong in JavaScript, it belongs in CSS, a thing that already exists and that browsers are optimized to use. Some people outright hate the idea of CSS-in-JS.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |