Open HridayK97 opened 3 years ago
Yes it's possible. You have to register toast.
That work for me
<ToastContext.Consumer>
{({toast})
=> {
registerToast(toast);
return (
<>
//Your code
</>
)
}}
</ToastContext.Consumer>
export let toastFn: (options: ToastConfig) => void;
export function registerToast(fn: (options: ToastConfig) => void): void {
toastFn = fn;
}
@HridayK97 That's what you meant?
@feleko Thanks for your support, but for me this solution didn't help, because JSX is still necessary. There is a way to trigger toast on a simple function (without React Component), redux actions for example?
Is there a way to trigger the toast outside of the react component/jsx. I need a way to reference and trigger the toast in a redux action.