Custom hook call outside useEffect?
Unanswered
Expensiveee posted this in #help-forum
Hi, is it possible to create a custom hook "useToast" and use it like this:
const toasts = useToast();
const toast = toasts.create("Hello");
const handleToast = () => {
toast.play(0);
};1 Reply
I use zustand for state management
The problem with this is, because my toasts.create is outside a useEffect hook it gets ran mulitple times
But I really want to be able to first initialize my toast, then play it with to play function
The problem with this is, because my toasts.create is outside a useEffect hook it gets ran mulitple times
But I really want to be able to first initialize my toast, then play it with to play function