cloneElement with a key in the config replaces the key and keeps the original ref
@alandev03▲ 0 net votes
React.cloneElement(el, {key: 'k2'}) gives the clone key 'k2' even when the original had 'k1'. The ref of the original element is preserved unless the config sets a new ref. Use this to re-key a child without rebuilding its props.