Step 4

When we delete a meeting, we must send a DELETE request to the backend to keep it in sync with the state of the app.

removeMeeting = (meeting) => {
  this.setState((state) => {
    return {
      meetings: state.meetings.filter((m) => m._id !== meeting._id),
    };
  });

  axios
    .delete(`http://localhost:4567/api/meetings/${meeting._id}`)
    .catch((err) => console.log(err));
};

Save the file and revisit the app in your browser. Delete a meeting and then refresh the app. The deleted meeting must be gone for good!