app/actions.js 'use server'
 
export async function addItem(data) {
  const cartId = cookies().get('cartId')?.value
  await saveToDb({ cartId, data })
}
app/add-to-cart.js 'use client'
 
import { addItem } from './actions.js'
 
// Server Action being called inside a Client Component
export default function AddToCart({ productId }) {
  return (
    <form action={addItem}>
      <button type="submit">Add to Cart</button>
    </form>
  )
}
Good to know:
Using Server Actions will opt into running the React experimental channel.
React Actions, useOptimistic, and useFormStatus are not a Next.js or React Server Components specific features.