css
css(taggedTemplate)
@returns {String}
Returns the className.
To create a className, you need to call css
with your style rules in a tagged template.
css
#
Different ways of customizing css
tagged templates#
Passing props to css
with JSON/Object#
Using Notice: using css
with object can reduce your bundle size.
We also can declare the styles at the top of the file by wrapping css
into a function that we call to get the className.
The difference between calling css
directly and wrapping into a function is the timing of its execution. The former is when the component(file) is imported, the latter is when it is actually rendered.
If you use extractCSS
for SSR, you may prefer to use the latter or styled
api to avoid inconsistent results.