Home / Function/ validateFunctionComponentInDev() — react Function Reference

validateFunctionComponentInDev() — react Function Reference

Architecture documentation for the validateFunctionComponentInDev() function in ReactFiberBeginWork.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e97df9a2_1803_92a2_50c0_f4ba3f1bebaa["validateFunctionComponentInDev()"]
  0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"]
  e97df9a2_1803_92a2_50c0_f4ba3f1bebaa -->|defined in| 0be70812_cc0c_b210_f84f_8e61dd5f831c
  a032b50f_d1ac_c367_9f15_394d8f0023c1["updateMemoComponent()"]
  a032b50f_d1ac_c367_9f15_394d8f0023c1 -->|calls| e97df9a2_1803_92a2_50c0_f4ba3f1bebaa
  50e17875_d138_1098_df3a_5e5668c9be3d["updateFunctionComponent()"]
  50e17875_d138_1098_df3a_5e5668c9be3d -->|calls| e97df9a2_1803_92a2_50c0_f4ba3f1bebaa
  53f55fda_e2b6_2801_4fbc_525f8828d23d["updateHostRoot()"]
  53f55fda_e2b6_2801_4fbc_525f8828d23d -->|calls| e97df9a2_1803_92a2_50c0_f4ba3f1bebaa
  style e97df9a2_1803_92a2_50c0_f4ba3f1bebaa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberBeginWork.js lines 2212–2249

function validateFunctionComponentInDev(workInProgress: Fiber, Component: any) {
  if (__DEV__) {
    if (Component && Component.childContextTypes) {
      console.error(
        'childContextTypes cannot be defined on a function component.\n' +
          '  %s.childContextTypes = ...',
        Component.displayName || Component.name || 'Component',
      );
    }

    if (typeof Component.getDerivedStateFromProps === 'function') {
      const componentName = getComponentNameFromType(Component) || 'Unknown';

      if (!didWarnAboutGetDerivedStateOnFunctionComponent[componentName]) {
        console.error(
          '%s: Function components do not support getDerivedStateFromProps.',
          componentName,
        );
        didWarnAboutGetDerivedStateOnFunctionComponent[componentName] = true;
      }
    }

    if (
      typeof Component.contextType === 'object' &&
      Component.contextType !== null
    ) {
      const componentName = getComponentNameFromType(Component) || 'Unknown';

      if (!didWarnAboutContextTypeOnFunctionComponent[componentName]) {
        console.error(
          '%s: Function components do not support contextType.',
          componentName,
        );
        didWarnAboutContextTypeOnFunctionComponent[componentName] = true;
      }
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does validateFunctionComponentInDev() do?
validateFunctionComponentInDev() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberBeginWork.js.
Where is validateFunctionComponentInDev() defined?
validateFunctionComponentInDev() is defined in packages/react-reconciler/src/ReactFiberBeginWork.js at line 2212.
What calls validateFunctionComponentInDev()?
validateFunctionComponentInDev() is called by 3 function(s): updateFunctionComponent, updateHostRoot, updateMemoComponent.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free