You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
‡ compiled to throw Error( "Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + "). If you meant to render a collection of children, use an array instead." );
So, react won't use valueOf to render an element, but will use it to report and error about an element.
Maybe the "compilation" or interpolation of invariant is wrong?
Or perhaps %s handling in invariant is wrong?
Maybe my assumptions are wrong?
Maybe that type is wrong?
React version: 17.0.1
Steps To Reproduce
return <div>{ new Temporal.Instant(0n).toZonedDateTimeISO("Europe/Berlin") }</div>;
@dimaqq do you want to put in a PR to fix it? You should be able to just change newChild to Object.prototype.toString.call(newChild) in the three or so places that this error is thrown.
That change would result in this message:
Objects are not valid as a React child (found: [object Temporal.ZonedDateTime]). If you meant to render a collection of children, use an array instead."
Activity
rickhanlonii commentedon Jan 18, 2021
Confirmed.
@dimaqq do you want to put in a PR to fix it? You should be able to just change
newChildtoObject.prototype.toString.call(newChild)in the three or so places that this error is thrown.That change would result in this message:
Avoid .valueOf to close #20594 (#20617)
Avoid .valueOf to close react#20594 (react#20617)
Replace `'' + obj` pattern with `''.concat(obj)`
Replace `'' + obj` pattern with `''.concat(obj)`
Replace `'' + obj` pattern with `''.concat(obj)`
Avoid .valueOf to close react#20594 (react#20617)