MCPcopy
hub / github.com/facebook/react / countChildren

Function countChildren

packages/react/src/ReactChildren.js:383–390  ·  view source on GitHub ↗

* Count the number of children that are typically specified as * `props.children`. * * See https://reactjs.org/docs/react-api.html#reactchildrencount * * @param {?*} children Children tree container. * @return {number} The number of children.

(children: ?ReactNodeList)

Source from the content-addressed store, hash-verified

381 * @return {number} The number of children.
382 */
383function countChildren(children: ?ReactNodeList): number {
384 let n = 0;
385 mapChildren(children, () => {
386 n++;
387 // Don't return anything
388 });
389 return n;
390}
391
392type ForEachFunc = (child: ?React$Node) => void;
393

Callers

nothing calls this directly

Calls 1

mapChildrenFunction · 0.85

Tested by

no test coverage detected