({
children,
onClick,
}: {
children: React.ReactNode
onClick: any
})
| 3 | import Spinner from './Spinner' |
| 4 | |
| 5 | export default function Button({ |
| 6 | children, |
| 7 | onClick, |
| 8 | }: { |
| 9 | children: React.ReactNode |
| 10 | onClick: any |
| 11 | }) { |
| 12 | const [isPending, startTransition] = React.useTransition() |
| 13 | |
| 14 | const handleClick = (e: any) => { |
| 15 | startTransition(() => { |
| 16 | onClick(e) |
| 17 | }) |
| 18 | } |
| 19 | |
| 20 | return ( |
| 21 | <> |
| 22 | <button onClick={handleClick} disabled={isPending}> |
| 23 | {children} {isPending ? <Spinner /> : null} |
| 24 | </button> |
| 25 | </> |
| 26 | ) |
| 27 | } |
nothing calls this directly
no outgoing calls
no test coverage detected