Home / Function/ newUnreachable() — react Function Reference

newUnreachable() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6c672222_212c_f636_461c_cc6d37bc9347["newUnreachable()"]
  94915e97_e9c3_c422_6269_4bbf858b3cf3["CodePathSegment"]
  6c672222_212c_f636_461c_cc6d37bc9347 -->|defined in| 94915e97_e9c3_c422_6269_4bbf858b3cf3
  3f78bfce_0dd7_08fe_731e_35240fc9240b["flattenUnusedSegments()"]
  6c672222_212c_f636_461c_cc6d37bc9347 -->|calls| 3f78bfce_0dd7_08fe_731e_35240fc9240b
  0fb6e129_9f7c_9df0_9e75_b9fd2992f912["markUsed()"]
  6c672222_212c_f636_461c_cc6d37bc9347 -->|calls| 0fb6e129_9f7c_9df0_9e75_b9fd2992f912
  style 6c672222_212c_f636_461c_cc6d37bc9347 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

  static newUnreachable(id, allPrevSegments) {
    const segment = new CodePathSegment(
      id,
      CodePathSegment.flattenUnusedSegments(allPrevSegments),
      false,
    );

    /*
     * In `if (a) return a; foo();` case, the unreachable segment preceded by
     * the return statement is not used but must not be remove.
     */
    CodePathSegment.markUsed(segment);

    return segment;
  }

Domain

Subdomains

Frequently Asked Questions

What does newUnreachable() do?
newUnreachable() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-segment.js.
Where is newUnreachable() defined?
newUnreachable() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-segment.js at line 121.
What does newUnreachable() call?
newUnreachable() calls 2 function(s): flattenUnusedSegments, markUsed.

Analyze Your Own Codebase

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

Try Supermodel Free