[SOLVED]-REACT TOASTIFY CLEAR OR FALSE WHEN BUTTON CLICK-REACTJS
REACT TOASTIFY CLEAR OR FALSE WHEN BUTTON CLICK-REACTJS
you might want to check its documentation for clearing all the toast. here is what i have found
ref: https://webronix.com/blogs/solved-remove-toast-programmatically/
to remove all the toast use:
toast.dismiss();
in your context do like this.
const addrecord= (form) => {
toast.dismiss(); // i need to hide all toast notification
const header = {
auth_token: `${appuserconfig.accesstokenname}=${appuserconfig.accesstoken}`,
user_name: appuserconfig.username,
};
httppost(save_invoice, data, header)
.then((response) => {
if (response.status === 200) {
toast.success('successfully saved', { position: toast.position.top_right })
}
})
.catch((e) => {
console.log("e:", e);
toast.error('something went wrong', { position: toast.position.top_right, autoclose: false })
});
}