Skip to content Skip to sidebar Skip to footer

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:

  1. In the modal where you show selectedSubject, replace each value (text) you want to edit with input element.
  2. changing value in input should update state.selectedSubject in Schedule component or you might have state in modal to capture edited selectedSubject, but why duplicating data if you don't have to. I would go with updating parent component state.
  3. Schedule component should have method which will make put (or patch) request with edited data.
  4. Pass this method to the modal.
  5. Add "Save" button to the modal. When you finish editing, clicking on "Save" button should fire passed method.
  6. 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?"