3

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,
      });
Mustafa Zahedi
  • 103
  • 1
  • 1
  • 9

1 Answers1

2

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
});
Raflesia
  • 55
  • 1
  • 9