Question on CSS within React

So, I’m starting my React Journey and I had a question about CSS files. Up until now I have always used one CSS file for a project and have seem everyone else do the same.

Now that I’m approaching React, I’ve noticed people using more than one CSS file.

Is it good practice to have a CSS file for each React component? This is what I assume people are doing. I am used to having one big CSS file that holds everything but maybe that’s not the standard of doing things with React.

I have seen many have a global css file that is used for the overall site for things like font family and more global site design features. For components, I do not use a separate css file for each. I prefer using the styled components library. You can write CSS in the component file without having to worry about importing a css file.

I have not heard of the styled components library but I’m sure this course will go over it at some point. Thank you!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.