Submit Form using Button in Parent Component in React

前端 未结 3 1530
予麋鹿
予麋鹿 2021-02-13 13:08

So I have to implement a form in modal, as you can see, the button in the modal are not the buttons in the form. I created the form as a child component of the modal. H

3条回答
  •  情话喂你
    2021-02-13 13:44

    The simplest solution would be to use HTML form Attribute

    Add "id" attribute to your form: id='my-form'

    Add the appropriate "form" attribute to the needed button outside of the form: form='my-form'

提交回复
热议问题