Home / Function/ useFoo() — react Function Reference

useFoo() — react Function Reference

Architecture documentation for the useFoo() function in hoisting-setstate-captured-indirectly-jsx.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  41d69519_6fcd_33bf_6881_67a8c94721f8["useFoo()"]
  a8664ee7_40a4_7262_6078_34bd26444297["hoisting-setstate-captured-indirectly-jsx.js"]
  41d69519_6fcd_33bf_6881_67a8c94721f8 -->|defined in| a8664ee7_40a4_7262_6078_34bd26444297
  style 41d69519_6fcd_33bf_6881_67a8c94721f8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-setstate-captured-indirectly-jsx.js lines 2–17

function useFoo() {
  const onClick = response => {
    setState(DISABLED_FORM);
  };

  const [state, setState] = useState();
  const handleLogout = useCallback(() => {
    setState(DISABLED_FORM);
  }, [setState]);
  const getComponent = () => {
    return <ColumnItem onPress={() => handleLogout()} />;
  };

  // this `getComponent` call should not be inferred as mutating setState
  return [getComponent(), onClick]; // pass onClick to avoid dce
}

Subdomains

Frequently Asked Questions

What does useFoo() do?
useFoo() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-setstate-captured-indirectly-jsx.js.
Where is useFoo() defined?
useFoo() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-setstate-captured-indirectly-jsx.js at line 2.

Analyze Your Own Codebase

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

Try Supermodel Free