Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by mb2100 on Monday February 16, 2026 @03:32PM
(#47039940)
if you're not using CSS modules, why would you import the css file into your javascript?
But anyway, I think we agree. Feel free to read the linked blog post ;-)
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by ggregoire on Monday February 16, 2026 @03:36PM
(#47039995)
Yes we agree, my comment was for tailwind users. :) I was replying to you because you gave the example of a Button component, and it's a good example to demonstrate that you don't need tailwind to style components.
Even for keeping the style close to the component, you can just use standard css.
Create a folder Button, create two files Button.tsx and Button.css in that folder, import the css file in the tsx file, add a class "button" on the first element the tsx file renders, start all the rules in the css file with ".button " to encapsulate the style.
People will say it's too much work, but it took me like 5 sec.