I have a delete button in react that when clicked, my deleteHandler() is fired and the window comes up however when I try to click outside the window it doesnt disappear? So the user is forced to refresh the page to cancel the delete functionality.
const deleteHandler = (id) => {
if (window.alert('Are you sure you want to delete?')) {
dispatch(deleteCoin(id));
alert(`Coin of Lot# ${id} deleted successfully.`);
}
};
try this!!
const deleteHandler = (id) => {
if (window.confirm('Are you sure you want to delete?')) {
dispatch(deleteCoin(id));
alert(`Coin of Lot# ${id} deleted successfully.`);
}
};