* Generate a key string that identifies a component within a set. * * @param {*} component A component that could contain a manual key. * @param {number} index Index that is used if a manual key is not provided. * @return {string}
(component, index)
| 17014 | * @return {string} |
| 17015 | */ |
| 17016 | function getComponentKey(component, index) { |
| 17017 | if (component && component.key != null) { |
| 17018 | // Explicit key |
| 17019 | return wrapUserProvidedKey(component.key); |
| 17020 | } |
| 17021 | // Implicit key determined by the index in the set |
| 17022 | return index.toString(36); |
| 17023 | } |
| 17024 | |
| 17025 | /** |
| 17026 | * Escape a component key so that it is safe to use in a reactid. |
no test coverage detected