removeJSXFragmentChildren() — react Function Reference
Architecture documentation for the removeJSXFragmentChildren() function in minimize.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 7967b1de_cd97_e07a_6df4_cb6f4785531d["removeJSXFragmentChildren()"] 9c061da8_dbf8_4168_823d_991654a3c55d["minimize.ts"] 7967b1de_cd97_e07a_6df4_cb6f4785531d -->|defined in| 9c061da8_dbf8_4168_823d_991654a3c55d 7a9af496_ef6a_d9e8_8eaf_1f386f49e4b3["cloneAst()"] 7967b1de_cd97_e07a_6df4_cb6f4785531d -->|calls| 7a9af496_ef6a_d9e8_8eaf_1f386f49e4b3 style 7967b1de_cd97_e07a_6df4_cb6f4785531d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/snap/src/minimize.ts lines 1434–1468
function* removeJSXFragmentChildren(ast: t.File): Generator<t.File> {
// Collect all JSX fragments with children
const fragmentSites: Array<{fragIndex: number; childCount: number}> = [];
let fragIndex = 0;
t.traverseFast(ast, node => {
if (t.isJSXFragment(node) && node.children.length > 0) {
fragmentSites.push({fragIndex, childCount: node.children.length});
fragIndex++;
}
});
// For each fragment, try removing each child one at a time (from end to start)
for (const {fragIndex: targetFragIdx, childCount} of fragmentSites) {
for (let childIdx = childCount - 1; childIdx >= 0; childIdx--) {
const cloned = cloneAst(ast);
let idx = 0;
let modified = false;
t.traverseFast(cloned, node => {
if (modified) return;
if (t.isJSXFragment(node) && node.children.length > 0) {
if (idx === targetFragIdx && childIdx < node.children.length) {
node.children.splice(childIdx, 1);
modified = true;
}
idx++;
}
});
if (modified) {
yield cloned;
}
}
}
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does removeJSXFragmentChildren() do?
removeJSXFragmentChildren() is a function in the react codebase, defined in compiler/packages/snap/src/minimize.ts.
Where is removeJSXFragmentChildren() defined?
removeJSXFragmentChildren() is defined in compiler/packages/snap/src/minimize.ts at line 1434.
What does removeJSXFragmentChildren() call?
removeJSXFragmentChildren() calls 1 function(s): cloneAst.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free