File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff 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 ' +
You can’t perform that action at this time.
0 commit comments