DEV Community

Discussion on: How to isolate component styles in React using CSS modules

Collapse
 
eransakal profile image
Eran Sakal • Edited

Hi,
Thanks for reading. css module library has its limitations. Some things fit nicely into the css modules design, for example, tip #7 that lets you set :global selectors under you component selector. It also lets you handle nesting in .scss by flatting their names when exporting them as a javascript object. But since it must flat the list of selectors, you "lose" some flexibility and some features.

I recommend you to give css-in-js a try, I'm using it in large scale projects and can do everything you mentioned and even more because you can use javascript to perform calculations or manage a theme at runtime.

Thanks Again :)