( fn: T, deps: DependencyList = [] )
| 2 | import useAsyncFn, { FunctionReturningPromise } from './useAsyncFn'; |
| 3 | |
| 4 | export default function useAsync<T extends FunctionReturningPromise>( |
| 5 | fn: T, |
| 6 | deps: DependencyList = [] |
| 7 | ) { |
| 8 | const [state, callback] = useAsyncFn(fn, deps, { |
| 9 | loading: true, |
| 10 | }); |
| 11 | |
| 12 | useEffect(() => { |
| 13 | callback(); |
| 14 | }, [callback]); |
| 15 | |
| 16 | return state; |
| 17 | } |
nothing calls this directly
no test coverage detected