04 / 06

How to use server functions with Actions?

  1. 1

    You can pass a Server Function to a Form to automatically submit the form to the server.

  2. 2

    You can call Server Functions with useActionState for the common case where you just need access to the action pending state and last returned response:

Server function
With useTransition():
Directly with form action:
Using useActionState: