Server Actions in Next.js: Mutations Without Writing an API
A Server Action is an async function that runs on the server but can be called from a form or a client component. Next.js creates the endpoint for you. A form that writes to the database // app/todos/page.tsx import { revalidatePath } from 'next/cache'; import...