import { useNavigation } from "@wacht/react-router";
export function CancelButton() {
const { replace, goBack } = useNavigation();
// Triggered when a user aborts an onboarding flow
const handleCancelClick = () => {
// Attempt to gracefully retreat one step logically
goBack();
// In scenarios where goBack() might fail (e.g. they landed directly
// on this nested page), you could alternatively enforce a hard replace:
// replace("/dashboard");
};
return (
<button
onClick={handleCancelClick}
className="text-zinc-600 hover:text-red-600 font-medium px-4 py-2"
>
Cancel and Return
</button>
);
}