Home / Function/ createCustomHook() — react Function Reference

createCustomHook() — react Function Reference

Architecture documentation for the createCustomHook() function in error.nested-hook-in-normal-function.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  87388e70_5d6c_48fc_9a09_accb5fe816f6["createCustomHook()"]
  a6eb8e7f_a445_6269_a9bc_056aeb4e6b70["error.nested-hook-in-normal-function.js"]
  87388e70_5d6c_48fc_9a09_accb5fe816f6 -->|defined in| a6eb8e7f_a445_6269_a9bc_056aeb4e6b70
  style 87388e70_5d6c_48fc_9a09_accb5fe816f6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.nested-hook-in-normal-function.js lines 4–16

function createCustomHook(config) {
  function useConfiguredState() {
    const [state, setState] = useState(0);

    const increment = () => {
      setState(state + config.step);
    };

    return [state, increment];
  }

  return useConfiguredState;
}

Subdomains

Frequently Asked Questions

What does createCustomHook() do?
createCustomHook() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.nested-hook-in-normal-function.js.
Where is createCustomHook() defined?
createCustomHook() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.nested-hook-in-normal-function.js at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free