2 ms·
> I don’t miss the days of emotion and styled components where I would have to think of a name for every styled div in the project I see people mention this is
by dbbk 2y ago
> I don’t miss the days of emotion and styled components where I would have to think of a name for every styled div in the project
I see people mention this issue fairly frequently, and it puzzles me a little. I have never once spent probably more than 1 second thinking about what to name something. Is it actually a blocker for some people? Are you really paralysed by this?
- agos 2y agoespecially since with any decent CSS solution (any css in js, or CSS modules) you can reuse names
- dbbk 2y agoLike really, I use Styled Components, just call it a Wrapper or InnerWrapper or Row or whatever and move on
- gausswho 2y agoThere was a time when BEM ruled (and scarred) the world. But names aren't a problem if you abandon the C in CSS and scope all styles to component.
- werdnapk 2y agoI'd say BEM was a passing fad, but didn't rule the world. I also think tailwind will suffer the same fate, but we'll see how it plays out.
- Kerrick 2y agoWhat I don't understand is why BEM is scarring. If you're talking about the reason or timing something looks different, you must have named it in that conversation. Just use that name. "When the menu is wide, the items' icons and text should be visible. When it's skinny, only the icons should be visible. This button toggles between them." .menu {} .menu--skinny {} .menu--wide {} .menu__icon {} .menu__text {}
- jitl 2y agoOr I could just express this in code once - in the spot where I attach the class names to the HTML - instead of attaching class names, just attach styles.