Server Actions
Docs
Unstable (alpha)
Revalidate Tag
Key takeaways:
- Functions with 'use server'should have serializable arguments and a serializable return value
- There are 3 ways to call such functions (first two support progressive enhancement):- actionprop on a form
- formActionprop on- <button>,- <input type="submit">, and- <input type="image">in a form
- startTransition
 
- useOptimisticto implement optimistic updates
- useFormStatusto get the status of a form submission
- We can't define server actions in client components, but we can pass them as props
- We can import server functions inside client components
- Two ways to revalidate a page:- revalidatePath
- revalidateTag
 
- We can use cookies()andheaders()functions in server actions
- We can modify cookies (basically they are read-only)