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
v4 passes through unknown HTML attribute to the DOM #2131
Comments
Don't think that it is expected behavior. Also example from docs https://www.styled-components.com/docs/basics#attaching-additional-props works in similar way: |
This is definitely a bug, any ideas why this broke @probablyup? |
What's interesting is that styled-components@3.x works much the same but instead of camelCase props are inserted in lowercase and React doesn't warn about this. |
Oh, that's even more strange 🤔 |
I'm seeing a similar issue with the new ...
import { Link } from 'react-router-dom';
const StyledLink = styled.a`
${p => (p.linkStyle === 'upperCase' ? 'text-transform: uppercase' : '')}
`
<StyledLink as={Link} linkStyle="upperCase" to="/">test link</StyledLink>
Is this related to an existing issue or should I open a new issue? |
@mbrowne Since |
Is there any ETA on when this can be addressed? Or let me know if I can help with the PR and what the challenge is. |
As a workaround for eliminating React warnings in custom components, I had to make use of |
Will this be resolved in v5 for the |
Any update on this now that v5 beta is out? I'm attempting to use Formik's Field component with styled-components and want to customize the css if an error is present or not. |
Still I'm getting error.. 😢 |
Seeing as this still happens in v5 for custom components, can we reopen this issue? Or create a new one? |
This isn’t a bug, we explicitly do not filter props for custom components because we don’t know if the component needs to consume the prop as well.
…Sent from my iPhone
On Jan 15, 2020, at 5:59 AM, GuilleDF ***@***.***> wrote:
Seeing as this still happens in v5 for custom components, can we reopen this issue? Or create a new one?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@probablyup @mxstbr Why can't we filter properties based on some prefix like
The |
I proposed this a while ago actually. We could, but if another library
decides to do the same it’d be a mess basically.
…On Mon, Feb 3, 2020 at 4:26 AM Akhil Pentamsetti ***@***.***> wrote:
@probablyup <https://github.com/probablyup> @mxstbr
<https://github.com/mxstbr> Why can't we filter properties based on some
prefix like $, like below?
<StyledComp $someStyleProp={someValue} />
The $someStyleProp will not be passed down as the user explicitly wants
to ignore the property being passed down?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2131?email_source=notifications&email_token=AAELFVWYG3NO43GUTLD7JMDRA7PODA5CNFSM4F6GZO5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKTDLNQ#issuecomment-581318070>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAELFVW7BXTHUHXBLZLRTU3RA7PODANCNFSM4F6GZO5A>
.
|
The top answer here solved it for me |
Environment
npm packages:
Reproduction
https://codesandbox.io/s/zn5vrk0vpm
Expected Behavior
https://codesandbox.io/s/20xlp242pr
There is no unknown-prop warning if I'm using
styled(styled.button).attrs({ customProp })
with styled-components v3.4.10.Actual Behavior
There is unknown-prop warning with styled-components v4.
If this is not a bug, and there is something missing. Please let me know, thanks!
The text was updated successfully, but these errors were encountered: