* 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)
| 1332 | |
| 1333 | |
| 1334 | function onlyChild(children) { |
| 1335 | if (!isValidElement(children)) { |
| 1336 | { |
| 1337 | throw Error( "React.Children.only expected to receive a single React element child." ); |
| 1338 | } |
| 1339 | } |
| 1340 | |
| 1341 | return children; |
| 1342 | } |
| 1343 | |
| 1344 | function createContext(defaultValue, calculateChangedBits) { |
| 1345 | if (calculateChangedBits === undefined) { |
nothing calls this directly
no test coverage detected