Home / Function/ constructor() — react Function Reference

constructor() — react Function Reference

Architecture documentation for the constructor() function in code-path.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  4e41b91a_6c96_6629_b90b_d3a1e82bd201["constructor()"]
  9d0ad6be_3800_8694_06ab_1b89f16d8205["CodePath"]
  4e41b91a_6c96_6629_b90b_d3a1e82bd201 -->|defined in| 9d0ad6be_3800_8694_06ab_1b89f16d8205
  style 4e41b91a_6c96_6629_b90b_d3a1e82bd201 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path.js lines 28–64

  constructor({id, origin, upper, onLooped}) {
    /**
     * The identifier of this code path.
     * Rules use it to store additional information of each rule.
     * @type {string}
     */
    this.id = id;

    /**
     * The reason that this code path was started. May be "program",
     * "function", "class-field-initializer", or "class-static-block".
     * @type {string}
     */
    this.origin = origin;

    /**
     * The code path of the upper function scope.
     * @type {CodePath|null}
     */
    this.upper = upper;

    /**
     * The code paths of nested function scopes.
     * @type {CodePath[]}
     */
    this.childCodePaths = [];

    // Initializes internal state.
    Object.defineProperty(this, 'internal', {
      value: new CodePathState(new IdGenerator(`${id}_`), onLooped),
    });

    // Adds this into `childCodePaths` of `upper`.
    if (upper) {
      upper.childCodePaths.push(this);
    }
  }

Domain

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path.js.
Where is constructor() defined?
constructor() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path.js at line 28.

Analyze Your Own Codebase

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

Try Supermodel Free