How to use toasts with useActionState?
Answered
Southern rough shrimp posted this in #help-forum
Southern rough shrimpOP
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
you can check the formState inside a useEffect like this:
useEffect(() => {
// work with your formstate
toast("something happend to formState")
}, [formState])
Answer