I want to create a toast with two buttons "accept" and "reject". when I click reject I want to dismiss the only toast which contains these two buttons.
i simply want the toast to disappear when i click the reject button inside the toast.
Here is my custom toat with callingToast
component-
const toastId = toast(CallingToast, {
...toastOptions,
autoClose: 60000,
closeButton: false,
pauseOnHover: false,
closeOnClick: false,
});
Below is my calling toast component-
import React from 'react';
import { toast } from 'react-toastify';
export default function CallingToast() {
return (
<>
<button>accept</button>
<button
onClick={}
>
reject
</button>
</>
);
}
I tried calling toast.dismiss()
on the reject butto, but it dismisses all of the toast which I don't want.
I also tried passing toastId
to the component somehow but it obviously didn't work. I couldn't find any related questions as well that's why posting my own.