'How to prevent double model in toggle button
here handelDlt is onclick function of cancel button and changeStatus() is onclick function of toggle button, here if I want to change the status from close to open or open to close that change button functionality working fine and its give one model that do yo want to change from open to close or close to open.in toggle button functionality its working fine but 2 time its throwing the model like if i change status from open to close its throwing 2 model for cancel button like do you want to want to change from open to close and do you want to change from close to open. How can I hide the second one mode in cancel button .even I use e.preventDefault() but its not working
function changeStatus() {
checked
? formik.setFieldValue("status", "Closed")
: formik.setFieldValue("status", "Open");
}
let handelDlt = (e) => {
setOpen(false);
setChecked(!checked);
changeStatus();
e.stopPropagation();
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
