"use client"; import { useState, useTransition } from "react"; import { useRouter } from "next/navigation"; type ActionResult = { ok: true } | { error: string }; export function ConfirmDeleteButton({ onDelete, label, }: { onDelete: () => Promise; label: string; }) { const router = useRouter(); const [confirming, setConfirming] = useState(false); const [error, setError] = useState(""); const [isPending, startTransition] = useTransition(); if (confirming) { return ( Delete {label}? {error && {error}} ); } return ( ); }