GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Move React Map child check to behind flags or __DEV__ (#17995) · react/react@c55c34e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react/src
    • ReactChildren.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react/src/ReactChildren.js‎

Copy file name to clipboardExpand all lines: packages/react/src/ReactChildren.js
+11-10Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,18 @@ function traverseAllChildrenImpl(
159159
} else {
160160
const iteratorFn = getIteratorFn(children);
161161
if (typeof iteratorFn === 'function') {
162-
if (iteratorFn === children.entries) {
163-
if (disableMapsAsChildren) {
164-
invariant(
165-
false,
166-
'Maps are not valid as a React child (found: %s). Consider converting ' +
167-
'children to an array of keyed ReactElements instead.',
168-
children,
169-
);
170-
}
162+
if (disableMapsAsChildren) {
163+
invariant(
164+
iteratorFn !== children.entries,
165+
'Maps are not valid as a React child (found: %s). Consider converting ' +
166+
'children to an array of keyed ReactElements instead.',
167+
children,
168+
);
169+
}
170+
171+
if (__DEV__) {
171172
// Warn about using Maps as children
172-
if (__DEV__) {
173+
if (iteratorFn === children.entries) {
173174
if (!didWarnAboutMaps) {
174175
console.warn(
175176
'Using Maps as children is deprecated and will be removed in ' +

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.