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 — Avoid .valueOf to close #20594 (#20617) · react/react@2e948e0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-reconciler/src
    • ReactChildFiber.new.js
    • ReactChildFiber.old.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-reconciler/src/ReactChildFiber.new.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactChildFiber.new.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,15 @@ function coerceRef(
222222

223223
function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) {
224224
if (returnFiber.type !== 'textarea') {
225+
const childString = Object.prototype.toString.call(newChild);
225226
invariant(
226227
false,
227228
'Objects are not valid as a React child (found: %s). ' +
228229
'If you meant to render a collection of children, use an array ' +
229230
'instead.',
230-
Object.prototype.toString.call(newChild) === '[object Object]'
231+
childString === '[object Object]'
231232
? 'object with keys {' + Object.keys(newChild).join(', ') + '}'
232-
: newChild,
233+
: childString,
233234
);
234235
}
235236
}
Collapse file

‎packages/react-reconciler/src/ReactChildFiber.old.js‎

Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactChildFiber.old.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,15 @@ function coerceRef(
222222

223223
function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) {
224224
if (returnFiber.type !== 'textarea') {
225+
const childString = Object.prototype.toString.call(newChild);
225226
invariant(
226227
false,
227228
'Objects are not valid as a React child (found: %s). ' +
228229
'If you meant to render a collection of children, use an array ' +
229230
'instead.',
230-
Object.prototype.toString.call(newChild) === '[object Object]'
231+
childString === '[object Object]'
231232
? 'object with keys {' + Object.keys(newChild).join(', ') + '}'
232-
: newChild,
233+
: childString,
233234
);
234235
}
235236
}

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.