Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in error.ref-value-in-custom-component-event-handler-wrapper.tsx from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f477583e_828a_417d_be7a_45f5ce8119fc["Component()"]
  57528d61_6e20_7a8b_9091_bcac592a8eed["error.ref-value-in-custom-component-event-handler-wrapper.tsx"]
  f477583e_828a_417d_be7a_45f5ce8119fc -->|defined in| 57528d61_6e20_7a8b_9091_bcac592a8eed
  5e23ba74_cdb1_a8b1_7854_7ea0e981a892["handleSubmit()"]
  f477583e_828a_417d_be7a_45f5ce8119fc -->|calls| 5e23ba74_cdb1_a8b1_7854_7ea0e981a892
  style f477583e_828a_417d_be7a_45f5ce8119fc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.ref-value-in-custom-component-event-handler-wrapper.tsx lines 17–36

function Component() {
  const ref = useRef<HTMLInputElement>(null);

  const onSubmit = (data: any) => {
    // This should error: passing function with ref access to custom component
    // event handler, even though it would be safe on a native <form>
    if (ref.current !== null) {
      console.log(ref.current.value);
    }
  };

  return (
    <>
      <input ref={ref} />
      <CustomForm onSubmit={handleSubmit(onSubmit)}>
        <button type="submit">Submit</button>
      </CustomForm>
    </>
  );
}

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/error.ref-value-in-custom-component-event-handler-wrapper.tsx.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.ref-value-in-custom-component-event-handler-wrapper.tsx at line 17.
What does Component() call?
Component() calls 1 function(s): handleSubmit.

Analyze Your Own Codebase

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

Try Supermodel Free