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
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter