From ea559a1e668e0902e37188d6029c38bc4afa85a1 Mon Sep 17 00:00:00 2001 From: sagar Date: Thu, 9 Jan 2020 20:26:38 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20FIX:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/UseAsync.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snippets/UseAsync.md b/snippets/UseAsync.md index e4242318e..561582f2f 100644 --- a/snippets/UseAsync.md +++ b/snippets/UseAsync.md @@ -23,12 +23,13 @@ const useAsync = (fn, options = {}) => { try { setIsLoading(true) const value = await fn(args) + setIsLoading(false) setError(null) setValue(value) } catch (error) { setIsLoading(false) - setValue(null) setError(error) + setValue(null) } }