DEV Community

Discussion on: Getting started with styled-components in React

Collapse
 
emma profile image
Emma Goto 🍙

Great question! It looks like styled components does provide this with a createGlobalStyle API, I've found a Medium article that explains how to use it.

Personally when I've needed global CSS, I do just put it into a regular CSS file. I think it would be more of a preference thing as to how you want to manage your styles. The one benefit of using that createGlobalStyle would be if you had a prop you wanted to pass into it e.g. you could pass in a isDarkMode boolean to inform what colour to render the font / background color with.

Collapse
 
marinafroes profile image
Marina Costa

Great. I'll read about the createGlobalStyle API. Thanks so much for answering. :D