Next.js Discord

Discord Forum

Client side toast component in server side file

Answered
Spectacled Caiman posted this in #help-forum
Open in Discord
Spectacled CaimanOP
How can I use my sonner toast notification in a server side file? The code is here: https://sourceb.in/PzV3CQbx1y
and I want to notify the user when something goes wrong and I don't know how to call my toast component from the SSR file
Answered by Arinji
You can't
View full answer

6 Replies

You can't
Answer
Instead make a client component
Call your action from there
And return on errors or success which you toast
@Spectacled Caiman
Spectacled CaimanOP
alright bet, thank you