MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / flattenChildren

Function flattenChildren

code/composition/public/app.js:14558–14575  ·  view source on GitHub ↗
(children)

Source from the content-addressed store, hash-verified

14556var didWarnSelectedSetOnOption = false;
14557
14558function flattenChildren(children) {
14559 var content = '';
14560
14561 // Flatten children and warn if they aren't strings or numbers;
14562 // invalid types are ignored.
14563 // We can silently skip them because invalid DOM nesting warning
14564 // catches these cases in Fiber.
14565 React.Children.forEach(children, function (child) {
14566 if (child == null) {
14567 return;
14568 }
14569 if (typeof child === 'string' || typeof child === 'number') {
14570 content += child;
14571 }
14572 });
14573
14574 return content;
14575}
14576
14577/**
14578 * Implements an <option> host component that warns when `selected` is set.

Callers 1

getHostProps$1Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected