-
Is it possible to continue showing the toast even when the component it is in unmounts? I am showing toast in a modal. Once submit is done, I show the toast and close the modal. But since the Toast is in the component in modal, the toast disappears when modal closes. I can move the toast to a parent component. But doing this will make the parent have a lot of code for toasts if there are multiple modals in the parent. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This isn’t possible as that behaviour is core to the React paradigm, if you’re rendering a toast within It’s fairly common to create an abstraction that can be used to render toasts in a different part of the tree for example. Do you have an example of your code you could share? we might be able to suggest some approaches to make this easier to manage. |
Beta Was this translation helpful? Give feedback.
This isn’t possible as that behaviour is core to the React paradigm, if you’re rendering a toast within
Dialog.Content
it will become unmounted when its parent is removed from the tree.It’s fairly common to create an abstraction that can be used to render toasts in a different part of the tree for example.
Do you have an example of your code you could share? we might be able to suggest some approaches to make this easier to manage.