-
The solution is a CSS utilities framework, the most popular being Tailwind CSS. This framework gives you CSS classes for all styling rules, such as mb-1, text-sm and sm:w-full. You can prefix states (hover:, active:, etc) and breakpoints (sm:, lg: , etc). See the documentation for more things you can do with Tailwind. The important thing here is that the framework only creates minimal abstractions (e.g. color names and sizes). The component remains the main source of abstraction.
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
styled-components
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
There are two ways to apply styling to HTML: the style attribute and using CSS. While the style attribute can only change the style of the element itself, CSS lets you target classes, siblings, children and has additional features like media queries. Using the style attribute is considered an anti-pattern as it allows no abstraction and re-usability. While I think it's true that we shouldn't use the style attribute, I believe the original arguments in favor of CSS - abstraction and re-usability - no longer hold. With the coming of the component era, CSS classes have lost their appeal. Even CSS-in-JS libraries like styled-component and emotion seem to take the wrong approach. But let's back up a little first.
-
There are two ways to apply styling to HTML: the style attribute and using CSS. While the style attribute can only change the style of the element itself, CSS lets you target classes, siblings, children and has additional features like media queries. Using the style attribute is considered an anti-pattern as it allows no abstraction and re-usability. While I think it's true that we shouldn't use the style attribute, I believe the original arguments in favor of CSS - abstraction and re-usability - no longer hold. With the coming of the component era, CSS classes have lost their appeal. Even CSS-in-JS libraries like styled-component and emotion seem to take the wrong approach. But let's back up a little first.