Home / Function/ cloneAndReplaceKey() — react Function Reference

cloneAndReplaceKey() — react Function Reference

Architecture documentation for the cloneAndReplaceKey() function in ReactJSXElement.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  b08010e3_571c_f8e9_f77b_875161a3dce7["cloneAndReplaceKey()"]
  1bf5591f_27a1_c79f_853a_6242549e0e07["ReactJSXElement.js"]
  b08010e3_571c_f8e9_f77b_875161a3dce7 -->|defined in| 1bf5591f_27a1_c79f_853a_6242549e0e07
  9e375f3a_dd2f_18ab_e2b2_0d6efc63b4b6["ReactElement()"]
  b08010e3_571c_f8e9_f77b_875161a3dce7 -->|calls| 9e375f3a_dd2f_18ab_e2b2_0d6efc63b4b6
  style b08010e3_571c_f8e9_f77b_875161a3dce7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react/src/jsx/ReactJSXElement.js lines 748–764

export function cloneAndReplaceKey(oldElement, newKey) {
  const clonedElement = ReactElement(
    oldElement.type,
    newKey,
    oldElement.props,
    !__DEV__ ? undefined : oldElement._owner,
    __DEV__ && oldElement._debugStack,
    __DEV__ && oldElement._debugTask,
  );
  if (__DEV__) {
    // The cloned element should inherit the original element's key validation.
    if (oldElement._store) {
      clonedElement._store.validated = oldElement._store.validated;
    }
  }
  return clonedElement;
}

Domain

Subdomains

Frequently Asked Questions

What does cloneAndReplaceKey() do?
cloneAndReplaceKey() is a function in the react codebase, defined in packages/react/src/jsx/ReactJSXElement.js.
Where is cloneAndReplaceKey() defined?
cloneAndReplaceKey() is defined in packages/react/src/jsx/ReactJSXElement.js at line 748.
What does cloneAndReplaceKey() call?
cloneAndReplaceKey() calls 1 function(s): ReactElement.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free