import React from "react"; type Props = { onClick: () => Promise; label: string; className?: string; }; const AsyncButton = ({ onClick, label, className }: Props) => { const [loading, setLoading] = React.useState(false); const handleClick = async () => { setLoading(true); await onClick(); setLoading(false); }; return ( ); }; export default AsyncButton;