MCPcopy Create free account
hub / github.com/react-hook-form/react-hook-form / CrossFrameForm

Function CrossFrameForm

app/src/crossFrameForm.tsx:24–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22};
23
24const CrossFrameForm: React.FC = () => {
25 const ref = React.useRef<HTMLIFrameElement>(null);
26
27 function renderFormInFrame() {
28 const rootElement =
29 ref.current!.contentDocument!.getElementById('inner-root');
30 const root = ReactDOM.createRoot(rootElement);
31 root.render(<FrameForm />);
32 }
33
34 return (
35 <iframe
36 ref={ref}
37 style={FRAME_STYLE}
38 srcDoc={FRAME_CONTENT}
39 onLoad={renderFormInFrame}
40 />
41 );
42};
43
44const FrameForm: React.FC = () => {
45 const { register, watch } = useForm();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected