Next.js Discord

Discord Forum

Functions between server and client

Unanswered
Rough harvester ant posted this in #help-forum
Open in Discord
Rough harvester antOP
If I reference a function in a file marked as 'use server' in a client component, does calling it make a http request to the server calling it?

2 Replies

yes.
Context:
Behind the scenes, actions use the POST method, and only this HTTP method can invoke them.

Source:
https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#behavior