* Warn if the element doesn't have an explicit key assigned to it. * This element is in an array. The array could grow and shrink or be * reordered. All children that haven't already been validated are required to * have a "key" property assigned to it. * * @internal * @param {ReactElement} el
(element, parentType)
| 9299 | * @param {*} parentType element's parent's type. |
| 9300 | */ |
| 9301 | function validateExplicitKey(element, parentType) { |
| 9302 | if (!element._store || element._store.validated || element.key != null) { |
| 9303 | return; |
| 9304 | } |
| 9305 | element._store.validated = true; |
| 9306 | |
| 9307 | var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); |
| 9308 | if (addenda === null) { |
| 9309 | // we already showed the warning |
| 9310 | return; |
| 9311 | } |
| 9312 | "development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined; |
| 9313 | } |
| 9314 | |
| 9315 | /** |
| 9316 | * Shared warning and monitoring code for the key warnings. |
no test coverage detected