You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to trigger toast methods inside a useEffect and got some eslint warnings because it wanted toast or notify to be added to the dependency array. But those references change anytime we create a new toast so adding to the dependency array triggers an infinite number of toasts to display.
Was a little surprised by this as I though they would behave more like useState setters. I was curious... do you think it would be more ergonomic if these hook methods had immutable references?
How to trigger:
Add the follow code snippet to useToastManager demo after handleClickOpenToast method
I think this issue can be resolved by using the useCallback Hook for those methods in ToastManager. Moreover, I'll check whether it is necessary to update the useToastManager Hook.
Hi,
I was trying to trigger toast methods inside a useEffect and got some eslint warnings because it wanted
toast
ornotify
to be added to the dependency array. But those references change anytime we create a new toast so adding to the dependency array triggers an infinite number of toasts to display.Was a little surprised by this as I though they would behave more like useState setters. I was curious... do you think it would be more ergonomic if these hook methods had immutable references?
How to trigger:
Add the follow code snippet to useToastManager demo after handleClickOpenToast method
The text was updated successfully, but these errors were encountered: