How to use toasts with useActionState?
Answered
Bighead carp posted this in #help-forum
Bighead carpOP
I'd like to create a
toast whenever the action has finished, either successfully or not. The action already returns if it was successful or not, but not sure how you're meant to handle it now you just plug the action into the React hookAnswered by B33fb0n3
you can check the formState inside a useEffect like this:
useEffect(() => {
// work with your formstate
toast("something happend to formState")
}, [formState])1 Reply
@Bighead carp I'd like to create a toast whenever the action has finished, either successfully or not. The action already returns if it was successful or not, but not sure how you're meant to handle it now you just plug the action into the React hook
you can check the formState inside a useEffect like this:
useEffect(() => {
// work with your formstate
toast("something happend to formState")
}, [formState])Answer