UNPKG

valync

Version:

**A lightweight, framework-agnostic async data handling library for React & Vue, inspired by Riverpod’s AsyncValue pattern and powered by ts-results-es.**

11 lines 691 B
import { ApiResponse, AsyncValue, ValyncOptions } from "../core"; export declare function createValyn({ client, }: { client: (url: string, init: RequestInit) => Promise<ApiResponse<any>>; }): <T>(key: string | Record<string, any>, options?: ValyncOptions<T>) => [AsyncValue<T>, () => void, (updater: (prev: T | null) => T) => void]; export declare function useValync<T>(key: string | Record<string, any>, options?: ValyncOptions<T>): readonly [{ when: <R>(handlers: import("../core").Handler<T, R>) => R; isLoading: () => boolean; isData: () => boolean; isError: () => boolean; }, () => void, (updater: (prev: T | null) => T) => void]; //# sourceMappingURL=index.d.ts.map