Files
blitzkit/packages/website/src/hooks/useAwait.ts
T

8 lines
227 B
TypeScript
Raw Normal View History

2024-01-21 22:11:01 -06:00
import usePromise from 'react-promise-suspense';
/**
* A more stable alternative to `use` using `usePromise`.
*/
export function useAwait<Type>(promise: Promise<Type>) {
return usePromise(async () => await promise, []);
}