source: imaps-frontend/node_modules/react-use/esm/useAsync.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 347 bytes
Line 
1import { useEffect } from 'react';
2import useAsyncFn from './useAsyncFn';
3export default function useAsync(fn, deps) {
4 if (deps === void 0) { deps = []; }
5 var _a = useAsyncFn(fn, deps, {
6 loading: true,
7 }), state = _a[0], callback = _a[1];
8 useEffect(function () {
9 callback();
10 }, [callback]);
11 return state;
12}
Note: See TracBrowser for help on using the repository browser.