Home / Function/ extractLocationFromComponentStack() — react Function Reference

extractLocationFromComponentStack() — react Function Reference

Architecture documentation for the extractLocationFromComponentStack() function in parseStackTrace.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9eb8363e_2b8e_188b_dba7_6b29d7e39de3["extractLocationFromComponentStack()"]
  c70671e1_42cb_8c92_da33_5303a72f89b1["parseStackTrace.js"]
  9eb8363e_2b8e_188b_dba7_6b29d7e39de3 -->|defined in| c70671e1_42cb_8c92_da33_5303a72f89b1
  aa8dcbb7_2a63_5ee0_2383_fe507f8a453f["parseStackTraceFromString()"]
  9eb8363e_2b8e_188b_dba7_6b29d7e39de3 -->|calls| aa8dcbb7_2a63_5ee0_2383_fe507f8a453f
  style 9eb8363e_2b8e_188b_dba7_6b29d7e39de3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/backend/utils/parseStackTrace.js lines 348–366

export function extractLocationFromComponentStack(
  stack: string,
): ReactFunctionLocation | null {
  const stackTrace = parseStackTraceFromString(stack, 0);
  for (let i = 0; i < stackTrace.length; i++) {
    const [functionName, fileName, line, col, encLine, encCol] = stackTrace[i];
    // Take the first match with a colon in the file name.
    if (fileName.indexOf(':') !== -1) {
      return [
        functionName,
        fileName,
        // Use enclosing line if available. (Never the case here because we parse from string.)
        encLine || line,
        encCol || col,
      ];
    }
  }
  return null;
}

Domain

Subdomains

Frequently Asked Questions

What does extractLocationFromComponentStack() do?
extractLocationFromComponentStack() is a function in the react codebase, defined in packages/react-devtools-shared/src/backend/utils/parseStackTrace.js.
Where is extractLocationFromComponentStack() defined?
extractLocationFromComponentStack() is defined in packages/react-devtools-shared/src/backend/utils/parseStackTrace.js at line 348.
What does extractLocationFromComponentStack() call?
extractLocationFromComponentStack() calls 1 function(s): parseStackTraceFromString.

Analyze Your Own Codebase

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

Try Supermodel Free