Clone and add class

PHOTO EMBED

Thu Dec 01 2022 02:12:26 GMT+0000 (Coordinated Universal Time)

Saved by @minhhung1106 #html

const element = (
<div>
   <span>1</span>
   <span>2</span>
</div>
)

const childElem = React.Children.map(element.children,  child => {
   React.cloneElement(child, { className: "", ...child.props })
})

const parentElem = React.Children.only(element);

parentElem.children = childElem
content_copyCOPY