react-hot-toast icon indicating copy to clipboard operation
react-hot-toast copied to clipboard

Prevent stacking

Open SaadBazaz opened this issue 1 year ago • 1 comments

I want to prevent the default notifications stacking on one another (I'm managing that on my own). Is there a way to do that in this lib?

SaadBazaz avatar Aug 31 '24 09:08 SaadBazaz

Hi @SaadBazaz, yes there is a way to prevent multiple toasts, I found in the documentation you need to add an object with id on it and then only one will be rendered. Here's an example: toast.error('Error! Attachment must be an Excel file', { id: 'attachment' }); image

CodeMasterZeroOne avatar Sep 20 '24 15:09 CodeMasterZeroOne

You can use an id like mentioned above to avoid duplication. If you want a max limit of toasts you can have a look here: #31

timolins avatar Dec 21 '24 14:12 timolins