Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Over 200 classes were generated" error on frequently used components #1026

Open
nadun-wije opened this issue Sep 21, 2020 · 0 comments
Open

Comments

@nadun-wije
Copy link

nadun-wije commented Sep 21, 2020

We use rebass with styled-components on our project. So we use the <Box /> and <Flex /> components a lot in our code.

When compiling, I get the following warning on the console:

Over 200 classes were generated for component styled.div with the id of "sc-AxjAm".
Consider using the attrs method, together with a style object for frequently changed styles.

Checking the elements reveal that the class name is used by the Box component, which gets different props to change the margins/paddings etc:

<Box mx={[5, 13]} my={7}>
   <MyComponent />
</Box>

Can the Box and Flex components be refactored to use the attrs method? If there's another solution to this I'd gladly take it as well.

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant