Hello, my question is this:
Does this have a callback? I need to click to redirect me to another page
notify () {
toast.error(
<spam><i className="fa fa-exclamation-circle" style={{ fontSize: 20, marginLeft: 10 }} />
<spam style={{ marginLeft: 10, fontSize: 10 }}> Error en un servicio </spam>
</spam>, {
className: ({
top: 40
})
})
}
Thank you!
Sorry for my English! I'm not very good...
Hello @Zequee98,
You can add callback when the toast open and when it closes. Define callback.
Is it what you are looking for ?
Thanks
Yes, but I need it to be when I click on the notification and redirect to another page.
I do not want to be redirected when I open or close the notification!
:+1:
Thanks
Something like a 'onClick'
Why not simply put a onClick event on your component like so:
toast.error(
<spam onClick={doSomething}><i className="fa fa-exclamation-circle" style={{ fontSize: 20, marginLeft: 10 }} />
<spam style={{ marginLeft: 10, fontSize: 10 }}> Error en un servicio </spam>
</spam>, {
className: ({
top: 40
})
})
What a teacher! Thank you!!
:+1:
You're welcome
@fkhadra unfortunatelly, with your solution user can click outside the rendered span/div, and just close toast without being redirected to other page. Having onClick for toast would be very great for that case.
Hey @Strate,
You want to redirect the user or perform any action when the user closes the toast right ?
@fkhadra not exactly.
If user closes toast by clicking on x button, toast should dismiss.
If user clicks on toast, then I want to perform some action (redirect to page, for example).
Chrome notifications work like I want to implement on page.
I tried to use onOpen - onClose callback but those work even when user clicks or not over toast, any idea?
Most helpful comment
@fkhadra not exactly.
If user closes toast by clicking on
xbutton, toast should dismiss.If user clicks on toast, then I want to perform some action (redirect to page, for example).
Chrome notifications work like I want to implement on page.