Home / Function/ ReactStrictModeWarnings() — react Function Reference

ReactStrictModeWarnings() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6f6a44c6_156a_2b50_a994_789da590ebd3["ReactStrictModeWarnings()"]
  95cbada5_3ad8_e19b_606d_d87294fdf73d["ReactStrictModeWarnings.js"]
  6f6a44c6_156a_2b50_a994_789da590ebd3 -->|defined in| 95cbada5_3ad8_e19b_606d_d87294fdf73d
  91cf9c4b_f49d_23fa_8818_f072a9d72dcd["setToSortedString()"]
  6f6a44c6_156a_2b50_a994_789da590ebd3 -->|calls| 91cf9c4b_f49d_23fa_8818_f072a9d72dcd
  style 6f6a44c6_156a_2b50_a994_789da590ebd3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactStrictModeWarnings.js lines 60–111

  ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = (
    fiber: Fiber,
    instance: any,
  ) => {
    // Dedupe strategy: Warn once per component.
    if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
      return;
    }

    if (
      typeof instance.componentWillMount === 'function' &&
      // Don't warn about react-lifecycles-compat polyfilled components.
      instance.componentWillMount.__suppressDeprecationWarning !== true
    ) {
      pendingComponentWillMountWarnings.push(fiber);
    }

    if (
      fiber.mode & StrictLegacyMode &&
      typeof instance.UNSAFE_componentWillMount === 'function'
    ) {
      pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
    }

    if (
      typeof instance.componentWillReceiveProps === 'function' &&
      instance.componentWillReceiveProps.__suppressDeprecationWarning !== true
    ) {
      pendingComponentWillReceivePropsWarnings.push(fiber);
    }

    if (
      fiber.mode & StrictLegacyMode &&
      typeof instance.UNSAFE_componentWillReceiveProps === 'function'
    ) {
      pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
    }

    if (
      typeof instance.componentWillUpdate === 'function' &&
      instance.componentWillUpdate.__suppressDeprecationWarning !== true
    ) {
      pendingComponentWillUpdateWarnings.push(fiber);
    }

    if (
      fiber.mode & StrictLegacyMode &&
      typeof instance.UNSAFE_componentWillUpdate === 'function'
    ) {
      pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
    }
  };

Domain

Subdomains

Frequently Asked Questions

What does ReactStrictModeWarnings() do?
ReactStrictModeWarnings() is a function in the react codebase, defined in packages/react-reconciler/src/ReactStrictModeWarnings.js.
Where is ReactStrictModeWarnings() defined?
ReactStrictModeWarnings() is defined in packages/react-reconciler/src/ReactStrictModeWarnings.js at line 60.
What does ReactStrictModeWarnings() call?
ReactStrictModeWarnings() calls 1 function(s): setToSortedString.

Analyze Your Own Codebase

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

Try Supermodel Free