* 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)
| 10235 | * @param {*} parentType element's parent's type. |
| 10236 | */ |
| 10237 | function validateExplicitKey(element, parentType) { |
| 10238 | if (!element._store || element._store.validated || element.key != null) { |
| 10239 | return; |
| 10240 | } |
| 10241 | element._store.validated = true; |
| 10242 | |
| 10243 | var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); |
| 10244 | if (addenda === null) { |
| 10245 | // we already showed the warning |
| 10246 | return; |
| 10247 | } |
| 10248 | "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 || '') : void 0; |
| 10249 | } |
| 10250 | |
| 10251 | /** |
| 10252 | * Shared warning and monitoring code for the key warnings. |
no test coverage detected
searching dependent graphs…