react-async-hook
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -24,6 +24,6 @@ export declare type AsyncState<R> = { | ||
}; | ||
export declare const useAsync: <R, Args extends any[]>(asyncFunction: (...args: Args) => Promise<R>, params: Args, options?: UseAsyncOptions<R>) => UseAsyncReturn<R, Args>; | ||
export declare const useAsync: <R, Args extends any[]>(asyncFunction: ((...args: Args) => Promise<R>) | (() => Promise<R>), params: Args, options?: UseAsyncOptions<R>) => UseAsyncReturn<R, Args>; | ||
declare type AddArg<H, T extends any[]> = ((h: H, ...t: T) => void) extends ((...r: infer R) => void) ? R : never; | ||
export declare const useAsyncAbortable: <R, Args extends any[]>(asyncFunction: (...args: AddArg<AbortSignal, Args>) => Promise<R>, params: Args, options?: UseAsyncOptions<R>) => UseAsyncReturn<R, Args>; | ||
export declare const useAsyncCallback: <R, Args extends any[]>(asyncFunction: (...args: Args) => MaybePromise<R>) => UseAsyncReturn<R, Args>; | ||
export declare const useAsyncAbortable: <R, Args extends any[]>(asyncFunction: ((...args: AddArg<AbortSignal, Args>) => Promise<R>) | ((abortSignal: AbortSignal) => MaybePromise<R>), params: Args, options?: UseAsyncOptions<R>) => UseAsyncReturn<R, Args>; | ||
export declare const useAsyncCallback: <R, Args extends any[]>(asyncFunction: ((...args: Args) => MaybePromise<R>) | (() => MaybePromise<R>)) => UseAsyncReturn<R, Args>; | ||
export {}; |
{ | ||
"name": "react-async-hook", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Async hook", | ||
@@ -5,0 +5,0 @@ "author": "Sébastien Lorber", |
@@ -6,5 +6,6 @@ # React-async-hook | ||
- Simplest way to get async result in your React component | ||
- Very good, native, Typescript support | ||
- Simplest way to get async result / feedback in your React component | ||
- Works with any React platform (ReactNative, Expo...) | ||
- Refetch on params change | ||
- Handle async callbacks (mutations) | ||
- Handle concurrency issues if params change too fast | ||
@@ -15,3 +16,4 @@ - Flexible, works with any async function, not just api calls | ||
- Options to customize state updates | ||
- Handle async callbacks (mutations) | ||
- Very good, native, Typescript support | ||
- Small and no dependency | ||
@@ -18,0 +20,0 @@ ## Usecase: loading async data into a component |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81711
262