-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
Update unknown props warning page #7848
Comments
Would you like to submit a PR to the doc page? |
Sure |
I understand the reasoning behind the props warning but what is the recommended way to apply non standard but valid html attributes that are not on the whitelist? For example take this component that simply wants to render a video via an iframe const VideoPlayer = ({ id }) => {
return (
<iframe src={`https://player.vimeo.com/video/${id}`} allowFullScreen webkitallowfullscreen mozallowfullscreen />
)
} Out of the 3 attributes ( While What is the recommended way to use them without getting this warning? I have used Whatever the answer perhaps this could be included in the docs. Cheers. |
@bennick same thing here |
@podrivo Yea I ended up using |
+1 |
I understand. +1’s are usually completely useless on the issues because they just spam the notifications for everyone but don’t give any valuable insight or new information. If you wish to “+1” an issue you can do so by using emoji “reactions” on GitHub that are available on every post. In my comment, I meant that I don’t understand what is here to +1. The problem reported in this issue (docs not mentioning something) has already been fixed. |
To clarify, all of the above attributes work in React 16: const VideoPlayer = ({ id }) => {
return (
<iframe
src={`https://player.vimeo.com/video/${id}`}
allowFullScreen="true"
webkitallowfullscreen="true"
mozallowfullscreen="true"
/>
)
} https://jsfiddle.net/Luktwrdm/ You just need to specify This is because different unknown attributes treat booleans in different ways (e.g. |
ah thanks for the clarification @gaearon |
Indeed. Thanks @gaearon! |
Thank you 🥇 |
What is the current behavior?
If I write a JSX component without an upper case, React gives me the unknown prop warning
I finally remember that
But I think it could be useful to remind it in the unknown props warning page as a reason of this warning.
I spent some time debugging and not understanding this warning in this case. And I might not be the only one!
What is the expected behavior?
Update unknown props warning page and add a reason this warning could be appearing:
4. You are using a JSX component without an upper case. React treats it as an HTML tag and probably doesn't recognize its props. React's JSX uses the upper vs. lower case convention to distinguish between local component classes and HTML tags.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
I use React 15.2.1
Let me know if you think it could be useful or it's just me who hasn't been enough careful!
The text was updated successfully, but these errors were encountered: