Skip to content

Commit 2c1d317

Browse files
committed
Fix: error still have value after success request
1 parent 4069603 commit 2c1d317

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-fetch-hook",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "React fetch hook",
55
"main": "./dist/index.js",
66
"scripts": {

src/usePromise.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function usePromise<T, I: $ReadOnlyArray<mixed>>(
3636
callFunction(...inputs)
3737
.then(data => {
3838
setData(data);
39+
setError(undefined);
3940
setLoading(false);
4041
})
4142
.catch(error => {

0 commit comments

Comments
 (0)