DEV Community

Discussion on: Let's Take a Look at CSS in JS with React in 2019 - Styled Components

Collapse
 
mvrs profile image
Marlon Johnson

The only thing I don't like about styled-components is the huge nested issue when it comes to debugging. With regular CSS/SASS it's easier to pinpoint which class belongs to what component via styles.scss.

Collapse
 
phizzard profile image
Phil Tietjen

Hey Marlon,

I think with the right structure for either approach can minimize debugging issues. I think where styled-components gets an edge is that because it's scoped, Ideally, you would only need to be concerned with it residing in the component's directory.

I typically create a style.js file where I define and export all my styles for my component to import
/ Component
--/ index.js
--/ Component.js
--/ style.js

I hope you enjoyed the read!