Home / Function/ isLegacyActEnvironment() — react Function Reference

isLegacyActEnvironment() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  804ab624_07ad_1af9_09a0_89a133e46dad["isLegacyActEnvironment()"]
  f6d3a9ed_72f5_c7df_64e0_1c680d088e57["ReactFiberAct.js"]
  804ab624_07ad_1af9_09a0_89a133e46dad -->|defined in| f6d3a9ed_72f5_c7df_64e0_1c680d088e57
  style 804ab624_07ad_1af9_09a0_89a133e46dad fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberAct.js lines 16–37

export function isLegacyActEnvironment(fiber: Fiber): boolean {
  if (__DEV__) {
    // Legacy mode. We preserve the behavior of React 17's act. It assumes an
    // act environment whenever `jest` is defined, but you can still turn off
    // spurious warnings by setting IS_REACT_ACT_ENVIRONMENT explicitly
    // to false.

    const isReactActEnvironmentGlobal =
      // $FlowFixMe[cannot-resolve-name] Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
      typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined'
        ? // $FlowFixMe[cannot-resolve-name]
          IS_REACT_ACT_ENVIRONMENT
        : undefined;

    // $FlowFixMe[cannot-resolve-name] - Flow doesn't know about jest
    const jestIsDefined = typeof jest !== 'undefined';
    return (
      warnsIfNotActing && jestIsDefined && isReactActEnvironmentGlobal !== false
    );
  }
  return false;
}

Domain

Subdomains

Frequently Asked Questions

What does isLegacyActEnvironment() do?
isLegacyActEnvironment() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberAct.js.
Where is isLegacyActEnvironment() defined?
isLegacyActEnvironment() is defined in packages/react-reconciler/src/ReactFiberAct.js at line 16.

Analyze Your Own Codebase

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

Try Supermodel Free