(oldElement, newKey)
| 684 | } |
| 685 | |
| 686 | export function cloneAndReplaceKey(oldElement, newKey) { |
| 687 | const clonedElement = ReactElement( |
| 688 | oldElement.type, |
| 689 | newKey, |
| 690 | oldElement.props, |
| 691 | !__DEV__ ? undefined : oldElement._owner, |
| 692 | __DEV__ && oldElement._debugStack, |
| 693 | __DEV__ && oldElement._debugTask, |
| 694 | ); |
| 695 | if (__DEV__) { |
| 696 | class="cm">// The cloned element should inherit the original element's key validation. |
| 697 | if (oldElement._store) { |
| 698 | clonedElement._store.validated = oldElement._store.validated; |
| 699 | } |
| 700 | } |
| 701 | return clonedElement; |
| 702 | } |
| 703 | |
| 704 | /** |
| 705 | * Clone and return a new ReactElement using element as the starting point. |
no test coverage detected