How To Update Data For Table Column In React?
Hi i have problem with my table in bootstrap. I am getting data from server about timetable. This data i am saving in state. Next i am creating table. (Two ways of creating mobile
Solution 1:
If I've undeerstood your q, this might work for you:
- In the modal where you show
selectedSubject
, replace each value (text) you want to edit with input element. - changing value in input should update
state.selectedSubject
inSchedule
component or you might have state in modal to capture editedselectedSubject
, but why duplicating data if you don't have to. I would go with updating parent component state. Schedule
component should have method which will make put (or patch) request with edited data.- Pass this method to the modal.
- Add "Save" button to the modal. When you finish editing, clicking on "Save" button should fire passed method.
- Optional: you can have success message in your modal (success or error)
Post a Comment for "How To Update Data For Table Column In React?"