Home / Function/ topLevelError() — react Function Reference

topLevelError() — react Function Reference

Architecture documentation for the topLevelError() function in ESLintRulesOfHooks-test.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  b26eb0e0_4fcc_6186_d16b_c6536f768a72["topLevelError()"]
  dd0557d9_69a8_cf13_71c6_3353d5972ec8["ESLintRulesOfHooks-test.js"]
  b26eb0e0_4fcc_6186_d16b_c6536f768a72 -->|defined in| dd0557d9_69a8_cf13_71c6_3353d5972ec8
  style b26eb0e0_4fcc_6186_d16b_c6536f768a72 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js lines 2065–2072

function topLevelError(hook) {
  return {
    message:
      `React Hook "${hook}" cannot be called at the top level. React Hooks ` +
      'must be called in a React function component or a custom React ' +
      'Hook function.',
  };
}

Domain

Subdomains

Frequently Asked Questions

What does topLevelError() do?
topLevelError() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js.
Where is topLevelError() defined?
topLevelError() is defined in packages/eslint-plugin-react-hooks/__tests__/ESLintRulesOfHooks-test.js at line 2065.

Analyze Your Own Codebase

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

Try Supermodel Free