You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/warnings/unknown-prop.md
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -3,23 +3,23 @@ title: Unknown Prop Warning
3
3
layout: single
4
4
permalink: warnings/unknown-prop.html
5
5
---
6
-
The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as a legal DOM attribute/property. You should ensure that your DOM elements do not have spurious props floating around.
1.Are you using `{...this.props}`or`cloneElement(element, this.props)`? Your component is transferring its own props directly to a child element (eg. [transferring props](/docs/transferring-props.html)). When transferring props to a child component, you should ensure that you are not accidentally forwarding props that were intended to be interpreted by the parent component.
2.You are using a non-standard DOM attribute on a native DOM node, perhaps to represent custom data. If you are trying to attach custom data to a standard DOM element, consider using a custom data attribute as described [on MDN](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes).
12
+
2.ุชุณุชุฎุฏู ุฎูุงุต DOM ุบูุฑ ููุงุณูุฉ ุนูู ุนููุฏุฉ DOM ุฃุตููุฉ ุฑุจู ุง ูุนุฑุถ ุจูุงูุงุช ู ูุฎุตุตุฉ. ุฅู ูููุช ุชูุญุงูู ุฑุจุท ุจูุงูุงุช ู ูุฎุตุตุฉ ุจูุนููุตุฑ DOM ุชูููุฏู ูุนููู ุจุงุณุชุฎุฏุงู ุฎุงุตูุฉ ุจูุงูุงุช ู ูุฎุตุตุฉ "custom data attribute" ููู ุง ุดูุฑูุญูุช [ุนูู MDN](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes).
13
13
14
-
3. React does not yet recognize the attribute you specified. This will likely be fixed in a future version of React. However, React currently strips all unknown attributes, so specifying them in your React app will not cause them to be rendered.
4.You are using a React component without an upper case. React interprets it as a DOM tag because [React JSX transform uses the upper vs. lower case convention to distinguish between user-defined components and DOM tags](/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized).
To fix this, composite components should "consume" any prop that is intended for the composite component and not intended for the child component. Example:
**Good:**You can also assign the props to a new object and delete the keys that you're using from the new object. Be sure not to delete the props from the original `this.props`object, since that object should be considered immutable.
0 commit comments