3 ms·
React doesn't force you to use any style method, you can output html and use css as usual. The problem is that css scales poorly for large projects, especially
by jbergens 9y ago
React doesn't force you to use any style method, you can output html and use css as usual.
The problem is that css scales poorly for large projects, especially when you build many components and mix them together. It is almost impossible to know which css rules are in effect for a specific part when you don't know where that part will end up and it is also hard to create css rules that continue to work since more parts and html may be added later which changes the css rule matching.
- huehehue 9y agoTo be fair there are other ways of solving that problem. If you're worried about class overlap, you can define unique/hash-based classnames on build with css-loader. If you're still worried about aggressive stylesheets destroying your components, you can wrap them in however many classes you see fit (some people might use `.n.e.a.t.l.i.b .cool-class` instead of polluting component code with CSS). As far as CSS scaling poorly, that's really up to you. I find that it's an afterthought to most people, and full of weird hacks and `!important`s a few months into a project. That's fine if that's how you want to do it, but it's not an inevitability. (I say this as someone working on a component library that's used on over half a million sites)