Next.js Discord

Discord Forum

Understanding when to use "use server"

Unanswered
In&Out posted this in #help-forum
Open in Discord
Avatar
In&OutOP
Hey folks, do I need to put "use server" on the file that is fetching some info from an API?
The API is just using cookies to pass as headers. Or to be precise, when exactly should I use "use server"?

2 Replies

Avatar
European sprat
It's used only in server action functions or at the top of a file that has multiple server actions