How to call a notification/toast after a server action in Nextjs13
Unanswered
Champagne D’Argent posted this in #help-forum
Champagne D’ArgentOP
Hi I am struggling to find out how to call a toast after a successful data mutation using server actions in Nextjs 13. The toast is a client component since it uses a hook/context.
How would I go about doing this?
How would I go about doing this?
1 Reply
Morelet’s Crocodile
If you're calling it inside of a client component, you should be able to do the following:
onSubmit={() =>
startTransition(() => {
yourServerAction();
toast.success("Successful")
})
}