( current: null | Fiber, workInProgress: Fiber, Component: any, nextProps: any, renderLanes: Lanes, )
| 1421 | } |
| 1422 | |
| 1423 | function updateFunctionComponent( |
| 1424 | current: null | Fiber, |
| 1425 | workInProgress: Fiber, |
| 1426 | Component: any, |
| 1427 | nextProps: any, |
| 1428 | renderLanes: Lanes, |
| 1429 | ) { |
| 1430 | if (__DEV__) { |
| 1431 | if ( |
| 1432 | Component.prototype && |
| 1433 | typeof Component.prototype.render === 'function' |
| 1434 | ) { |
| 1435 | const componentName = getComponentNameFromType(Component) || 'Unknown'; |
| 1436 | |
| 1437 | if (!didWarnAboutBadClass[componentName]) { |
| 1438 | console.error( |
| 1439 | "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + |
| 1440 | 'This is likely to cause errors. Change %s to extend React.Component instead.', |
| 1441 | componentName, |
| 1442 | componentName, |
| 1443 | ); |
| 1444 | didWarnAboutBadClass[componentName] = true; |
| 1445 | } |
| 1446 | } |
| 1447 | |
| 1448 | if (workInProgress.mode & StrictLegacyMode) { |
| 1449 | ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); |
| 1450 | } |
| 1451 | |
| 1452 | if (current === null) { |
| 1453 | // Some validations were previously done in mountIndeterminateComponent however and are now run |
| 1454 | // in updateFuntionComponent but only on mount |
| 1455 | validateFunctionComponentInDev(workInProgress, workInProgress.type); |
| 1456 | |
| 1457 | if (Component.contextTypes) { |
| 1458 | const componentName = getComponentNameFromType(Component) || 'Unknown'; |
| 1459 | |
| 1460 | if (!didWarnAboutContextTypes[componentName]) { |
| 1461 | didWarnAboutContextTypes[componentName] = true; |
| 1462 | if (disableLegacyContext) { |
| 1463 | console.error( |
| 1464 | '%s uses the legacy contextTypes API which was removed in React 19. ' + |
| 1465 | 'Use React.createContext() with React.useContext() instead. ' + |
| 1466 | '(https://react.dev/link/legacy-context)', |
| 1467 | componentName, |
| 1468 | ); |
| 1469 | } else { |
| 1470 | console.error( |
| 1471 | '%s uses the legacy contextTypes API which will be removed soon. ' + |
| 1472 | 'Use React.createContext() with React.useContext() instead. ' + |
| 1473 | '(https://react.dev/link/legacy-context)', |
| 1474 | componentName, |
| 1475 | ); |
| 1476 | } |
| 1477 | } |
| 1478 | } |
| 1479 | } |
| 1480 | } |
no test coverage detected