CupThread React Native & Expo SDK - v0.1.0
    Preparing search index...

    Interface UseAsyncDataResult<T>

    Return type of useAsyncData.

    interface UseAsyncDataResult<T> {
        data: T | null;
        error: Error | null;
        isLoading: boolean;
        isRefreshing: boolean;
        refresh: () => Promise<void>;
        reload: () => Promise<void>;
        setData: Dispatch<SetStateAction<T | null>>;
    }

    Type Parameters

    • T
    Index
    data: T | null

    The most recently loaded value, or null before the first successful load. Preserved when a refresh fails so stale data is never blanked out.

    error: Error | null

    The most recent fetch error, if any. Cleared on the next successful load.

    isLoading: boolean

    Whether the initial load (or a reload) is currently in flight.

    isRefreshing: boolean

    Whether a pull-to-refresh request is currently in flight.

    refresh: () => Promise<void>

    Runs a refresh with pull-to-refresh semantics: data stays visible while isRefreshing is true, and a failure keeps the stale data on screen.

    reload: () => Promise<void>

    Runs a full reload with isLoading = true. Aborts any in-flight request. Used to implement retry buttons.

    setData: Dispatch<SetStateAction<T | null>>

    Direct state setter for data.