MCPcopy Create free account
hub / github.com/plotly/dash / onlyChild

Function onlyChild

dash/deps/react@18.2.0.js:1217–1223  ·  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#reactchildrenonly * * The current implementation of this function assumes that a single child gets * passed without a

(children)

Source from the content-addressed store, hash-verified

1215
1216
1217 function onlyChild(children) {
1218 if (!isValidElement(children)) {
1219 throw new Error('React.Children.only expected to receive a single React element child.');
1220 }
1221
1222 return children;
1223 }
1224
1225 function createContext(defaultValue) {
1226 // TODO: Second argument used to be an optional `calculateChangedBits`

Callers

nothing calls this directly

Calls 1

isValidElementFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…