Home / Function/ addFork() — react Function Reference

addFork() — react Function Reference

Architecture documentation for the addFork() function in createFlowConfigs.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  07fb6643_c59b_953c_9585_53a1158ee784["addFork()"]
  58d7564a_60ca_fe34_fb9c_a10335b3f9f8["createFlowConfigs.js"]
  07fb6643_c59b_953c_9585_53a1158ee784 -->|defined in| 58d7564a_60ca_fe34_fb9c_a10335b3f9f8
  a6bf12e5_9e65_9a63_3833_a10afa833d8f["writeConfig()"]
  a6bf12e5_9e65_9a63_3833_a10afa833d8f -->|calls| 07fb6643_c59b_953c_9585_53a1158ee784
  dd9383c4_c91b_bae8_7ffb_5181c022bbd3["findForks()"]
  07fb6643_c59b_953c_9585_53a1158ee784 -->|calls| dd9383c4_c91b_bae8_7ffb_5181c022bbd3
  style 07fb6643_c59b_953c_9585_53a1158ee784 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/flow/createFlowConfigs.js lines 35–53

function addFork(forks, renderer, file) {
  let basePath = forkedFiles.get(file);
  if (!basePath) {
    basePath = findForks(file);
  }

  const baseFilename = file.slice(basePath.length + 1);

  const parts = renderer.split('-');
  while (parts.length) {
    const candidate = `forks/${baseFilename}.${parts.join('-')}.js`;
    if (allForks.has(candidate)) {
      forks.set(candidate, `${baseFilename}$$`);
      return;
    }
    parts.pop();
  }
  throw new Error(`Cannot find fork for ${file} for renderer ${renderer}`);
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does addFork() do?
addFork() is a function in the react codebase, defined in scripts/flow/createFlowConfigs.js.
Where is addFork() defined?
addFork() is defined in scripts/flow/createFlowConfigs.js at line 35.
What does addFork() call?
addFork() calls 1 function(s): findForks.
What calls addFork()?
addFork() is called by 1 function(s): writeConfig.

Analyze Your Own Codebase

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

Try Supermodel Free