You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a page with a main form, which uses onValidSubmit callback.
And a second sub form which is inside a modal (not related to the main form).
When I submit (via button) the modal form, the main form gets the submit event as well.
I've debugged it and found out that the issue is that the modal event form is propagated to the main one (this is how events works in React).
The problem is that I don't have the event in order to call stopPropagation on it.
I have a page with a main form, which uses
onValidSubmit
callback.And a second sub form which is inside a modal (not related to the main form).
When I submit (via button) the modal form, the main form gets the submit event as well.
I've debugged it and found out that the issue is that the modal event form is propagated to the main one (this is how events works in React).
The problem is that I don't have the event in order to call
stopPropagation
on it.https://codesandbox.io/s/fervent-dubinsky-pw99c?file=/src/App.tsx
Possible solution is to pass the submit event to the
onValidSubmit/onInvalidSubmit/onSubmit
as the last argumentMore info, https://reactjs.org/docs/portals.html#event-bubbling-through-portals
The text was updated successfully, but these errors were encountered: