MCPcopy Create free account
hub / github.com/DTStack/molecule / cloneReactChildren

Function cloneReactChildren

src/react/helper.ts:8–18  ·  view source on GitHub ↗
(
    children: React.ReactNode,
    props: P
)

Source from the content-addressed store, hash-verified

6 * @param props Parent props
7 */
8export function cloneReactChildren<P>(
9 children: React.ReactNode,
10 props: P
11): React.ReactNode {
12 return Children.map(children, (child) => {
13 if (isValidElement(child)) {
14 return cloneElement(child, props);
15 }
16 return child;
17 });
18}

Callers 5

helper.test.tsxFile · 0.90
MenuCompFunction · 0.90
SplitPaneFunction · 0.90
ListFunction · 0.90
SelectClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected