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) } }