From 2f5af2ca669a8b7c8f819a6e261f1ee8e52ef218 Mon Sep 17 00:00:00 2001 From: hahabazinga <952573581@qq.com> Date: Sat, 29 Dec 2018 23:26:15 +0800 Subject: [PATCH] fix: reset state when calling useEffect in useAsync --- src/useAsync.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/useAsync.ts b/src/useAsync.ts index 760bceca17..f9f2e1cc43 100644 --- a/src/useAsync.ts +++ b/src/useAsync.ts @@ -25,6 +25,9 @@ const useAsync = (fn: () => Promise, args?) => { useEffect(() => { let mounted = true; + set({ + loading: true, + }); const promise = memoized(); promise