error.ref-value-in-custom-component-event-handler-wrapper.tsx — react Source File
Architecture documentation for error.ref-value-in-custom-component-event-handler-wrapper.tsx, a tsx file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 57528d61_6e20_7a8b_9091_bcac592a8eed["error.ref-value-in-custom-component-event-handler-wrapper.tsx"] ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 57528d61_6e20_7a8b_9091_bcac592a8eed --> ac587885_e294_a1e9_b13f_5e7b920fdb42 style 57528d61_6e20_7a8b_9091_bcac592a8eed fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// @enableInferEventHandlers
import {useRef} from 'react';
// Simulates a custom component wrapper
function CustomForm({onSubmit, children}: any) {
return <form onSubmit={onSubmit}>{children}</form>;
}
// Simulates react-hook-form's handleSubmit
function handleSubmit<T>(callback: (data: T) => void) {
return (event: any) => {
event.preventDefault();
callback({} as T);
};
}
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>
</>
);
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{}],
};
Domain
Subdomains
Functions
Dependencies
- react
Source
Frequently Asked Questions
What does error.ref-value-in-custom-component-event-handler-wrapper.tsx do?
error.ref-value-in-custom-component-event-handler-wrapper.tsx is a source file in the react codebase, written in tsx. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in error.ref-value-in-custom-component-event-handler-wrapper.tsx?
error.ref-value-in-custom-component-event-handler-wrapper.tsx defines 3 function(s): Component, CustomForm, handleSubmit.
What does error.ref-value-in-custom-component-event-handler-wrapper.tsx depend on?
error.ref-value-in-custom-component-event-handler-wrapper.tsx imports 1 module(s): react.
Where is error.ref-value-in-custom-component-event-handler-wrapper.tsx in the architecture?
error.ref-value-in-custom-component-event-handler-wrapper.tsx is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.ref-value-in-custom-component-event-handler-wrapper.tsx (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free