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

Having to explicitly set the 'children' prop for EVERY component? #4264

Open
SteveAtKlover opened this issue Feb 22, 2024 · 3 comments
Open

Comments

@SteveAtKlover
Copy link

Hi, I use Styled Components all over my app, nested inside of each other many levels deep. I just upgraded to React 18 and now I have 200+ error messages saying I need to explicitly define the children prop for every single styled component that has a child. That seems utterly ridiculous and time-consuming. Is there an easy to way to get past this issue?

@multivoltage
Copy link

can you paste an example?

@SteveAtKlover
Copy link
Author

SteveAtKlover commented Mar 4, 2024

Here is my JSX...

const HeadlineLink = styled.a'
  color: ${theme.colors.text};
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
';

<HeadlineLink href={url} target="_blank" rel="noreferrer">
            <Headline>{title}</Headline>
</HeadlineLink>

and i get the error Property 'children' does not exist on type 'IntrinsicAttributes & {} & { theme?: any; } & { as?: string | undefined; forwardedAs?: string | undefined; }'.

@multivoltage
Copy link

What version of styled component?
What version of types react/react-dom?

I had similar issue in a project when I upgraded to react 18

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

2 participants