React toastify : Prevent displaying duplicate Toast

Viewed 543

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

1 Answers

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

Reference

Related