How does react render the react element generated by React.cloneElement () into a real dom, and mount it to a specified location

problem description

Editor written with react, now I need to copy the dom of a component (such as photo album, carousel.), including its sub-components. My current practice is to get the react element, of this component and then use React.cloneElement () to generate new elements. At this stage, I don"t know how to go on, novices don"t know how to render react elements to the specified dom?

Dec.24,2021


cloneElement(element, config, children)

takes three parameters, just like createElement , and the last return is the ReactElement react element.
so the usage is the same as createElement . All through render (ReactElement, target location)

Menu