Styled-components: All my styled components generate an empty css class

Created on 13 Apr 2018  路  1Comment  路  Source: styled-components/styled-components

Environment

I could reproduced on styled-components v3.2.5 and 3.2.3 and react-scripts 1.1.0 and 1.1.1.

Reproduction

https://codesandbox.io/s/n3v5mnqjj4

Steps to reproduce

You can inspect the red title or the div container.

Expected Behavior

It should only have one css class specifying the given css.

Actual Behavior

It creates a second empty css class for each styled component.

Most helpful comment

@sylvhama no need to worry about this, it's expected.

styled-components actually generates a minimum of two classes per element: a stable class to represent the element itself (used for component selectors mostly), and one or more classes used to represent particular rulesets. Dynamic styles will cause more than one additional class to be created.

>All comments

@sylvhama no need to worry about this, it's expected.

styled-components actually generates a minimum of two classes per element: a stable class to represent the element itself (used for component selectors mostly), and one or more classes used to represent particular rulesets. Dynamic styles will cause more than one additional class to be created.

Was this page helpful?
0 / 5 - 0 ratings