3 ms·
How do you create reusable styles this way?
by ailef 3y ago
How do you create reusable styles this way?
- bryanrasmussen 3y agomodern JS has a bunch of half-assed scenarios for solving this problem that allows you to solve almost everything CSS did a few years ago and helps keep people stuck in ineffective legacy ways of doing it because all their code would have to be rewritten to use straight css. I know because every place I've worked in the last few years uses some form of CSS in JS.
- hinkley 3y agoEvery five years or so prior to CSS 3, there was a push to purge styling and animation decisions from JS. We are meant to be past that now. Calling it a feature that you have CSS in your JS is tantamount to saying you’re writing legacy code. Which happens, but don’t be cheerful about it.
- Kiro 3y agoWith components. Same thing as when isolating styles to a component in various frameworks (e.g. Single-File Components in Vue) but instead of its own style tags I just put the styling directly in the HTML.