main
Last change
on this file since d565449 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 | |
---|
1 | import { useEffect } from 'react';
|
---|
2 | import useAsyncFn from './useAsyncFn';
|
---|
3 | export 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.