I have some data coming from database which I have shown on the UI. But I want to make those field editable on a button click. I have added images below for better understanding.
After Clicking The Edit Button
As you can see from the pictures I want something like this: When I click on the edit button the corresponding field get editable and the edit button change to save button. And when clicking the save button data will be submitted to an API, and the view will be change as before. How Can I do that.
This is my simple Code
<div className="col-sm-10 d-flex align-items-center">
<input
className="form-control mx-1"
value={item.name}
disabled
/>
<button className="text-end">
<i
style={{ color: "blue" }}
className="fas fa-edit d-block"
></i>
</button>
</div>