DEV Community

Discussion on: CSS Modules vs CSS-in-JS. Who wins?

fantasticmrhank profile image
Hank Queston

I agreed, CSS Modules make a lot more sense to me over Styled Components, always have!

kibobishtrudelz profile image
Petar Kolev

Did you ever used styled-components lib? If yes - for how long?
I personally have used them both and in my experience css-in-js is the more convenient way to go when it comes to write React applications. Yes, with css-in-js you don't have styled caching but this is a small price to pay for all the advantages you have with it over css modules.
This article is nice but it's definitely not covering all that can be said about css-in-js.

thekooldev1232 profile image

How about having to deal with libraries like Material UI with next js?

I have an issue to decide whether to use just makeStyles function or should we use styled components?

My main concern is code longevity and maintenance without any issues

alienpr84 profile image
Alien Padilla Rodriguez

@Petar Kokev If something I learned from this years of working with React and other projects is that the correct library for project isn't the correct library for another. So the mos important think that we need to do is select the tools, libraries and technologies that fit better to the current project. In this case you can't use Styled-components on sites that require a good SEO, becouse the mos important think here is the SEO and you cant sacrify it.