import { DependencyList } from "react"; import { AsyncStateOptions, AsyncStateResult, AsyncStateResultState } from "./useAsyncState.type"; /** * Create a state object for the useAsyncState hook * @param initialValue - The initial value of the state * @param callWithTruthyDeps - Whether to call the async function only when all dependencies are truthy * @returns An object with the state properties */ declare const createAsyncStateState: () => AsyncStateResultState; /** * Execute and async function and save the result in the component memory, * it will execute again each time deps change, and it return only the result * for the latest change * * @param callback - async function * @param deps - dependency list * @param options.initialValue - initial memo value (default=null) * @param options.callWithTruthyDeps - if true the effect will be executed only when * all values in the dependency list are evaluated as true */ declare const useAsyncState: (callback: () => Promise, deps?: DependencyList, options?: Partial>) => AsyncStateResult; export type { AsyncStateResultState, AsyncStateResult }; export { createAsyncStateState, useAsyncState };