Home / Function/ constructor() — react Function Reference

constructor() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  88af2f4b_0846_386a_d921_aee947ed2667["constructor()"]
  94915e97_e9c3_c422_6269_4bbf858b3cf3["CodePathSegment"]
  88af2f4b_0846_386a_d921_aee947ed2667 -->|defined in| 94915e97_e9c3_c422_6269_4bbf858b3cf3
  style 88af2f4b_0846_386a_d921_aee947ed2667 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-segment.js lines 34–81

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

    /**
     * An array of the next segments.
     * @type {CodePathSegment[]}
     */
    this.nextSegments = [];

    /**
     * An array of the previous segments.
     * @type {CodePathSegment[]}
     */
    this.prevSegments = allPrevSegments.filter(isReachable);

    /**
     * An array of the next segments.
     * This array includes unreachable segments.
     * @type {CodePathSegment[]}
     */
    this.allNextSegments = [];

    /**
     * An array of the previous segments.
     * This array includes unreachable segments.
     * @type {CodePathSegment[]}
     */
    this.allPrevSegments = allPrevSegments;

    /**
     * A flag which shows this is reachable.
     * @type {boolean}
     */
    this.reachable = reachable;

    // Internal data.
    Object.defineProperty(this, 'internal', {
      value: {
        used: false,
        loopedPrevSegments: [],
      },
    });
  }

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-segment.js.
Where is constructor() defined?
constructor() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-segment.js at line 34.

Analyze Your Own Codebase

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

Try Supermodel Free