useDebouncedAsyncValue Function

Beta  

Custom hook for working with promise values. Promises are debounced using trailing and leading edge. The first promise will always be executed. Any promises following the first while it is executing will be scheduled (and unscheduled), leaving only the last promise to be resolved. Once the first promise finishes resolving, the last passed promise starts resolving.

useDebouncedAsyncValue<TReturn>(valueToBeResolved: undefined | () => Promise<TReturn>): { inProgress: boolean, value: undefined | TReturn }

Parameter Type Description
valueToBeResolved undefined | () => Promise<TReturn>  

Returns - { inProgress: boolean, value: undefined | TReturn }

Defined in

Last Updated: 20 June, 2023