Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in ssr-infer-event-handlers-from-startTransition.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f5c2614f_2c69_45f0_7a22_ba89b43bb05a["Component()"]
  aa11a2cb_56d3_e0bc_aa5f_ae09a4193a51["ssr-infer-event-handlers-from-startTransition.js"]
  f5c2614f_2c69_45f0_7a22_ba89b43bb05a -->|defined in| aa11a2cb_56d3_e0bc_aa5f_ae09a4193a51
  style f5c2614f_2c69_45f0_7a22_ba89b43bb05a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssr/ssr-infer-event-handlers-from-startTransition.js lines 2–17

function Component() {
  const [, startTransition] = useTransition();
  const [state, setState] = useState(0);
  const ref = useRef(null);
  const onChange = e => {
    // The known startTransition call allows us to infer this as an event handler
    // and prune it
    startTransition(() => {
      setState.call(null, e.target.value);
    });
  };
  useEffect(() => {
    log(ref.current.value);
  });
  return <CustomInput value={state} onChange={onChange} ref={ref} />;
}

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/ssr/ssr-infer-event-handlers-from-startTransition.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssr/ssr-infer-event-handlers-from-startTransition.js at line 2.

Analyze Your Own Codebase

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

Try Supermodel Free