score:0

Accepted answer
const deleteHazard = () => {
  const removeId = hazardList.find((item) => item.hazardName === hazardName);
  const urlDelete = `http://localhost:8000/hazards/${removeId._id}`;
  axios.delete(urlDelete).then((response) => response.data);
  .catch((error) => console.error(error));
};

Related Query

More Query from same tag