File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -222,14 +222,15 @@ function coerceRef(
222222
223223function 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}
Original file line number Diff line number Diff line change @@ -222,14 +222,15 @@ function coerceRef(
222222
223223function 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}
You can’t perform that action at this time.
0 commit comments