Skip to main content

createGlobalStyle

(Again) borrowed from the likes of styled-components and goober, createGlobalStyle provides a way to style things that may be outside of your react tree or may not make sense to encapsulate under a component.

createGlobalStyle accepts an object whose keys are CSS Selectors and whose properties are rulesets.

Basic Usage#

Live Editor
Result
SyntaxError: No-Inline evaluations must call `render`.

Clean Up 🧹#

Global styles are only on the DOM as long as the component is mounted. For instance...

Live Editor
Result
SyntaxError: No-Inline evaluations must call `render`.

Dynamic Global Styles#

You can define property values as a function of the props passed to the component createGlobalStyles returns.

Live Editor
Result
SyntaxError: No-Inline evaluations must call `render`.