我有一些数据和表单输入,我需要在字段中预填充现有数据,当单击编辑时,我喜欢编辑数据并将其提交到单击按钮时的状态
const data = {
name: "nazar",
email: "nazar@gmail.com",
phone: 123456789
};
const [ editData, setEditData ] = useState()
function handleEdit(){
}
function handleSubmit(){
}
<form onChange={handleEdit}>
<input type="text" name='name'/><button>Edit</button><br/>
<input type="text" name='email'/><button>Edit</button><br/>
<input type="text" name='phone'/><button>Edit</button><br/>
<button type='submit' onSubmit={handleSubmit}>Submit</button>
</form>
1条答案
按热度按时间yeotifhr1#