UNPKG

@etsoo/react

Version:

TypeScript ReactJs UI Independent Framework

12 lines (11 loc) 464 B
import React from "react"; export declare function useAsyncState<S = undefined>(): [ S | undefined, (newState: React.SetStateAction<S | undefined>) => Promise<S | undefined> ]; /** * Returns a stateful value, and a async function to update it. * @param initialState initial stat * @returns Current state and update action */ export declare function useAsyncState<S>(initialState: S | (() => S)): [S, (newState: React.SetStateAction<S>) => Promise<S>];