Replies: 1 comment
-
Wouldn't this break toast accessibility as one might not have time to read a given message? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I have a requirement to create a Toast to display global messages (api failures etc), where only one message will be shown at a time. If a new message needs to be displayed while one is already visible, it should close the existing toast and open the new one.
One approach would be to useEffect( setOpen(true), [message]) inside my toast component, but this is an abuse of useEffect I believe? And because the duration isn't changing, the Toast closes too early (it doesn't treat this as a reset and uses the initial opens duration).
So I ended up copying your useImperativeHandle example to allow me to emit to this toast component, just wondering if this is the best approach as using this hook isn't a normal practice for me?
Parent component plugs into a redux store that is acting as my ESB, so on state changes I can call:
Beta Was this translation helpful? Give feedback.
All reactions