MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / getComponentKey

Function getComponentKey

code/event-handlers/public/app.js:18487–18496  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

18485 * @return {string}
18486 */
18487function getComponentKey(component, index) {
18488 // Do some typechecking here since we call this blindly. We want to ensure
18489 // that we don't block potential future ES APIs.
18490 if (typeof component === 'object' && component !== null && component.key != null) {
18491 // Explicit key
18492 return escape(component.key);
18493 }
18494 // Implicit key determined by the index in the set
18495 return index.toString(36);
18496}
18497
18498function forEachSingleChild(bookKeeping, child, name) {
18499 var func = bookKeeping.func,

Callers 1

traverseAllChildrenImplFunction · 0.70

Calls 1

escapeFunction · 0.70

Tested by

no test coverage detected