* Warn if the key is being defined as an object property but has an incorrect * value. * * @internal * @param {string} name Property name of the key. * @param {ReactComponent} component Component that requires a key. * @param {*} parentType component's parent's type.
(name, component, parentType)
| 8719 | * @param {*} parentType component's parent's type. |
| 8720 | */ |
| 8721 | function validatePropertyKey(name, component, parentType) { |
| 8722 | if (!NUMERIC_PROPERTY_REGEX.test(name)) { |
| 8723 | return; |
| 8724 | } |
| 8725 | warnAndMonitorForKeyUse( |
| 8726 | 'react_numeric_key_warning', |
| 8727 | 'Child objects should have non-numeric keys so ordering is preserved.', |
| 8728 | component, |
| 8729 | parentType |
| 8730 | ); |
| 8731 | } |
| 8732 | |
| 8733 | /** |
| 8734 | * Shared warning and monitoring code for the key warnings. |
no test coverage detected