(Component: any)
| 2628 | } |
| 2629 | |
| 2630 | function validateFunctionComponentInDev(Component: any): void { |
| 2631 | if (__DEV__) { |
| 2632 | if (Component && Component.childContextTypes) { |
| 2633 | console.error( |
| 2634 | 'childContextTypes cannot be defined on a function component.\n' + |
| 2635 | ' %s.childContextTypes = ...', |
| 2636 | Component.displayName || Component.name || 'Component', |
| 2637 | ); |
| 2638 | } |
| 2639 | |
| 2640 | if (typeof Component.getDerivedStateFromProps === 'function') { |
| 2641 | const componentName = getComponentNameFromType(Component) || 'Unknown'; |
| 2642 | |
| 2643 | if (!didWarnAboutGetDerivedStateOnFunctionComponent[componentName]) { |
| 2644 | console.error( |
| 2645 | '%s: Function components do not support getDerivedStateFromProps.', |
| 2646 | componentName, |
| 2647 | ); |
| 2648 | didWarnAboutGetDerivedStateOnFunctionComponent[componentName] = true; |
| 2649 | } |
| 2650 | } |
| 2651 | |
| 2652 | if ( |
| 2653 | typeof Component.contextType === 'object' && |
| 2654 | Component.contextType !== null |
| 2655 | ) { |
| 2656 | const componentName = getComponentNameFromType(Component) || 'Unknown'; |
| 2657 | |
| 2658 | if (!didWarnAboutContextTypeOnFunctionComponent[componentName]) { |
| 2659 | console.error( |
| 2660 | '%s: Function components do not support contextType.', |
| 2661 | componentName, |
| 2662 | ); |
| 2663 | didWarnAboutContextTypeOnFunctionComponent[componentName] = true; |
| 2664 | } |
| 2665 | } |
| 2666 | } |
| 2667 | } |
| 2668 | |
| 2669 | function renderForwardRef( |
| 2670 | request: Request, |
no test coverage detected