1 回答

TA貢獻(xiàn)1155條經(jīng)驗(yàn) 獲得超0個(gè)贊
click為作為元素onSubmit處理程序的刪除按鈕添加一個(gè)處理程序form。這樣當(dāng)您單擊它時(shí),它將調(diào)用表單的處理函數(shù)。
將 th 元素作為 prop傳遞handlerFunc給組件,以便能夠按以下方式使用它:
function YourComponent({ handler }){
return <th><button onClick={handler} className="delete">Delete</button></th>);
}
表單 onSubmit 句柄:
<form onSubmit={handlerFunc}>
<input type="text" placeholder="Enter name :"></input>
<input type="text" placeholder="Enter birth date :"></input>
<input type="text" placeholder="Enter gender :"></input>
<button type="submit">Submit entry!</button>
</form>
<YourComponent handler={handlerFunc} />
添加回答
舉報(bào)