UNPKG

use-state-promise

Version:

A custom useState hook with support for Promise

16 lines 585 B
import { Dispatch, SetStateAction } from 'react'; interface UseStatePromiseFn { <T>(initialState: T | (() => T), skipFirst?: boolean): readonly [ T, (value: SetStateAction<T>) => Promise<T>, Dispatch<SetStateAction<T>> ]; <T = undefined>(skipFirst?: boolean): readonly [ T | undefined, (value: SetStateAction<T | undefined>) => Promise<T | undefined>, Dispatch<SetStateAction<T | undefined>> ]; } export declare const useStatePromise: UseStatePromiseFn; export default useStatePromise; //# sourceMappingURL=index.d.ts.map