Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in ref-conditional-in-effect-no-error.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  3f29b547_66ea_ec35_10ae_9973818bf808["Component()"]
  ce745582_9a77_deb3_708e_fa7edcf8140c["ref-conditional-in-effect-no-error.js"]
  3f29b547_66ea_ec35_10ae_9973818bf808 -->|defined in| ce745582_9a77_deb3_708e_fa7edcf8140c
  style 3f29b547_66ea_ec35_10ae_9973818bf808 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/ref-conditional-in-effect-no-error.js lines 4–18

export default function Component({test}) {
  const [local, setLocal] = useState(0);

  const myRef = useRef(null);

  useEffect(() => {
    if (myRef.current) {
      setLocal(test);
    } else {
      setLocal(test + test);
    }
  }, [test]);

  return <>{local}</>;
}

Subdomains

Frequently Asked Questions

What does Component() do?
Component() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/ref-conditional-in-effect-no-error.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/ref-conditional-in-effect-no-error.js at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free