Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,16 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
workInProgress.stateNode = observedBits;

const render = newProps.children;

if (typeof render !== 'function') {
invariant(
false,
"A context consumer was rendered with multiple children, or a child that isn't a function. " +
'A context consumer expects a single child that is a function. ' +
'If you did pass a function, make sure there is no trailing or leading whitespace around it.',
);
}

const newChildren = render(newValue);
reconcileChildren(current, workInProgress, newChildren);
return workInProgress.child;
Expand Down