child() — react Function Reference
Architecture documentation for the child() function in ReactChildFiber.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 144ab801_d450_9870_f0bd_435a96715e62["child()"] 8a694f3e_c887_fb18_4515_e3e4488bb43e["ReactChildFiber.js"] 144ab801_d450_9870_f0bd_435a96715e62 -->|defined in| 8a694f3e_c887_fb18_4515_e3e4488bb43e style 144ab801_d450_9870_f0bd_435a96715e62 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactChildFiber.js lines 234–280
function validateFragmentProps(
element: ReactElement,
fiber: null | Fiber,
returnFiber: Fiber,
) {
if (__DEV__) {
const keys = Object.keys(element.props);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (
key !== 'children' &&
key !== 'key' &&
(enableFragmentRefs ? key !== 'ref' : true)
) {
if (fiber === null) {
// For unkeyed root fragments without refs (enableFragmentRefs),
// there's no Fiber. We create a fake one just for error stack handling.
fiber = createFiberFromElement(element, returnFiber.mode, 0);
if (__DEV__) {
fiber._debugInfo = currentDebugInfo;
}
fiber.return = returnFiber;
}
runWithFiberInDEV(
fiber,
erroredKey => {
if (enableFragmentRefs) {
console.error(
'Invalid prop `%s` supplied to `React.Fragment`. ' +
'React.Fragment can only have `key`, `ref`, and `children` props.',
erroredKey,
);
} else {
console.error(
'Invalid prop `%s` supplied to `React.Fragment`. ' +
'React.Fragment can only have `key` and `children` props.',
erroredKey,
);
}
},
key,
);
break;
}
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does child() do?
child() is a function in the react codebase, defined in packages/react-reconciler/src/ReactChildFiber.js.
Where is child() defined?
child() is defined in packages/react-reconciler/src/ReactChildFiber.js at line 234.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free