Files
axiom/src/components/AsyncValue.tsx
T
2025-10-26 20:22:25 +01:00

20 lines
338 B
TypeScript

"use client";
import useAsync from "@/hooks/use-async";
export default function AsyncValue<T, E = any>({
func,
render,
}: Readonly<{
func: () => Promise<T>;
render: ({
loading,
}: {
value: T | undefined;
loading: boolean;
error: E | undefined;
}) => React.ReactNode;
}>) {
return render(useAsync(func));
}