MCPcopy Index your code
hub / github.com/MoonHighway/learning-react / onlyChild

Function onlyChild

chapter-12/server-render-recipes/assets/bundle.js:2035–2038  ·  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://facebook.github.io/react/docs/react-api.html#react.children.only * * The current implementation of this function assumes that a single child gets * passed withou

(children)

Source from the content-addressed store, hash-verified

2033 * structure.
2034 */
2035function onlyChild(children) {
2036 !ReactElement_1.isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
2037 return children;
2038}
2039
2040var onlyChild_1 = onlyChild;
2041

Callers

nothing calls this directly

Calls 1

invariantFunction · 0.85

Tested by

no test coverage detected