Remote Submit in React Hook Form #8212
Unanswered
NasrinLatifi
asked this question in
General
Replies: 3 comments 10 replies
-
see this answer: #566 (comment) may helps you. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Just pass the const formId = "form-id"
return (
<>
<form id={formId} onSubmit={handleSubmit(onSubmit)}></form>
<button type="submit" form={formId}>Submit</button>
</>
) |
Beta Was this translation helpful? Give feedback.
9 replies
-
You can add a ref to the form component and dispatch a submit event to that form
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys!
I'm using React Hook Form. And I need to submit my form from another FC (Function Component).
I read the code of https://codesandbox.io/s/remote-handlesubmit-ipbqb?file=/src/App.js:490-1007, but it is submitted from the component that contains the form. But I need to submit it from another component.
Could you please guide me?
Beta Was this translation helpful? Give feedback.
All reactions