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
21 changes: 11 additions & 10 deletions packages/react/src/ReactChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,18 @@ function traverseAllChildrenImpl(
} else {
const iteratorFn = getIteratorFn(children);
if (typeof iteratorFn === 'function') {
if (iteratorFn === children.entries) {
if (disableMapsAsChildren) {
invariant(
false,
'Maps are not valid as a React child (found: %s). Consider converting ' +
'children to an array of keyed ReactElements instead.',
children,
);
}
if (disableMapsAsChildren) {
invariant(
iteratorFn !== children.entries,
'Maps are not valid as a React child (found: %s). Consider converting ' +
'children to an array of keyed ReactElements instead.',
children,
);
}

if (__DEV__) {
// Warn about using Maps as children
if (__DEV__) {
if (iteratorFn === children.entries) {
if (!didWarnAboutMaps) {
console.warn(
'Using Maps as children is deprecated and will be removed in ' +
Expand Down