Search code examples
react-toastify

React toastify : Prevent displaying duplicate Toast


How can i prevent displaying duplicates toast in react-toastify. I have setTimeout function that call an api every 5 seconds when token expired ,It's return expired token in toast.err. I wanna to not display a lot of toast for every call


Solution

  • You just need to provide a custom id to your toasts if id will remain same it wont duplicate.

    Reference