Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why toast.update in React-Toastify v.9 doesn't work properly

why the type and autoClose property does not work? in version 9 of react toastify package.

const toast1 = toast.loading("Please wait...");

const data = await setBooks(e);

toast.update(toast1, {
        render: "Oooups.., something goes wrong!",
        type: toast.TYPE.ERROR,
        autoClose: 2000,
        closeButton: true,
      });
like image 756
Mustafa Zahedi Avatar asked Oct 20 '25 17:10

Mustafa Zahedi


1 Answers

You have to set the loading to false for the autoClose to work. So add isLoading: false to the toast.update.

toast.update(toast1, {
   render: "Oooups.., something goes wrong!",
   type: toast.TYPE.ERROR,
   autoClose: 2000,
   closeButton: true,
   isLoading: false
});
like image 170
Raflesia Avatar answered Oct 23 '25 06:10

Raflesia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!