Home / Function/ makeIfAlternate() — react Function Reference

makeIfAlternate() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  89448ede_e4a2_b438_764f_09fc0f4bb23f["makeIfAlternate()"]
  d3cee22c_5e2d_f853_c075_2c7c55e5d22c["CodePathState"]
  89448ede_e4a2_b438_764f_09fc0f4bb23f -->|defined in| d3cee22c_5e2d_f853_c075_2c7c55e5d22c
  style 89448ede_e4a2_b438_764f_09fc0f4bb23f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-state.js lines 532–546

  makeIfAlternate() {
    const context = this.choiceContext;
    const forkContext = this.forkContext;

    /*
     * The head segments are the path of the `if` block.
     * Updates the `true` path with the end of the `if` block.
     */
    context.trueForkContext.clear();
    context.trueForkContext.add(forkContext.head);
    context.processed = true;

    // Creates new path from the `false` case.
    forkContext.replaceHead(context.falseForkContext.makeNext(0, -1));
  }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free