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

Function onlyChild

code/dependency-injection/public/app.js:19381–19384  ·  view source on GitHub ↗

* Returns the first child in a collection of children and verifies that there * is only one child in the collection. * * See https://reactjs.org/docs/react-api.html#react.children.only * * The current implementation of this function assumes that a single child gets * passed without a wrapper,

(children)

Source from the content-addressed store, hash-verified

19379 * structure.
19380 */
19381function onlyChild(children) {
19382 !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
19383 return children;
19384}
19385
19386function createContext(defaultValue, calculateChangedBits) {
19387 if (calculateChangedBits === undefined) {

Callers

nothing calls this directly

Calls 2

isValidElementFunction · 0.70
invariantFunction · 0.70

Tested by

no test coverage detected