(returnFiber: Fiber, invalidChild: Function)
| 331 | } |
| 332 | |
| 333 | function warnOnFunctionTypeImpl(returnFiber: Fiber, invalidChild: Function) { |
| 334 | if (__DEV__) { |
| 335 | const parentName = getComponentNameFromFiber(returnFiber) || 'Component'; |
| 336 | |
| 337 | if (ownerHasFunctionTypeWarning[parentName]) { |
| 338 | return; |
| 339 | } |
| 340 | ownerHasFunctionTypeWarning[parentName] = true; |
| 341 | |
| 342 | const name = invalidChild.displayName || invalidChild.name || 'Component'; |
| 343 | |
| 344 | if (returnFiber.tag === HostRoot) { |
| 345 | console.error( |
| 346 | 'Functions are not valid as a React child. This may happen if ' + |
| 347 | 'you return %s instead of <%s /> from render. ' + |
| 348 | 'Or maybe you meant to call this function rather than return it.\n' + |
| 349 | ' root.render(%s)', |
| 350 | name, |
| 351 | name, |
| 352 | name, |
| 353 | ); |
| 354 | } else { |
| 355 | console.error( |
| 356 | 'Functions are not valid as a React child. This may happen if ' + |
| 357 | 'you return %s instead of <%s /> from render. ' + |
| 358 | 'Or maybe you meant to call this function rather than return it.\n' + |
| 359 | ' <%s>{%s}</%s>', |
| 360 | name, |
| 361 | name, |
| 362 | parentName, |
| 363 | name, |
| 364 | parentName, |
| 365 | ); |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | function warnOnFunctionType(returnFiber: Fiber, invalidChild: Function) { |
| 371 | const debugTask = getCurrentDebugTask(); |
no test coverage detected