diff --git a/src/routes/solid-start/reference/server/use-server.mdx b/src/routes/solid-start/reference/server/use-server.mdx index c19e3fbf03..5f8be72126 100644 --- a/src/routes/solid-start/reference/server/use-server.mdx +++ b/src/routes/solid-start/reference/server/use-server.mdx @@ -17,14 +17,24 @@ description: >- Handle database operations, API calls, and secure logic on the server. --- -`"use server"` will enable functions that only run on the server. +`"use server"` enables functions or files to be executed only on the server. Server functions allow client components to call code that is executed in the server context. ```tsx +// Function-level const logHello = async (message: string) => { "use server"; console.log(message); }; ``` +Or when using at the top of a file. +```tsx +// File-level +"use server"; + +const logHello = async (message: string) => { + console.log(message); +}; +``` **Note:** `"use server"` functions must be marked async or return a promise.