Skip to content

Commit 5da6b4b

Browse files
committed
expose reset()
1 parent f66f9e9 commit 5da6b4b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-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-async-hook",
3-
"version": "3.3.0",
3+
"version": "3.3.1",
44
"description": "Async hook",
55
"author": "Sébastien Lorber",
66
"license": "MIT",

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export type UseAsyncReturn<
136136
Args extends any[] = never
137137
> = AsyncState<R> & {
138138
set: (value: AsyncState<R>) => void;
139+
reset: () => void;
139140
execute: (...args: Args) => Promise<R>;
140141
currentPromise: Promise<R> | null;
141142
};
@@ -199,6 +200,7 @@ const useAsyncInternal = <R, Args extends any[]>(
199200
return {
200201
...AsyncState.value,
201202
set: AsyncState.set,
203+
reset: AsyncState.reset,
202204
execute: executeAsyncOperation,
203205
currentPromise: CurrentPromise.get(),
204206
};

0 commit comments

Comments
 (0)