</form>
  )
}
Good to know: When using a top-level "use server" directive, all exports below will be considered Server Actions. You can have multiple Server Actions in a single file.
Invocation
You can invoke Server Actions using the following methods:
Using action: React's action prop allows invoking a Server Action on a <form> element.
Using formAction: React's formAction prop allows handling <button>, <input type="submit">, and <input type="image"> elements in a <form>.
Custom Invocation with startTransition: Invoke Server Actions without using action or formAction by using startTransition. This method disables Progressive Enhancement.
action
You can use React's action prop to invoke a Server Action on a form element. Server Actions passed with the action prop act as asynchronous side effects in response to user interaction.
app/add-to-cart.js import { cookies } from 'next/headers'