Membrane React - v0.29.2
    Preparing search index...

    Interface SWRResponse<Data, Error, Config>

    The response object returned by SWR hooks.

    This interface represents the return value of useSWR and related hooks, providing access to data, error state, and control functions.

    interface SWRResponse<Data = any, Error = any, Config = any> {
        data: (
            Config extends undefined
                ? false
                : Config extends { suspense: true }
                    ? true
                    : Config extends { fallbackData: Data | Promise<Data> } ? true : false
        ) extends true
            ? Data
            : Data | undefined;
        error: Error | undefined;
        mutate: KeyedMutator<Data>;
        isValidating: boolean;
        isLoading: boolean;
    }

    Type Parameters

    • Data = any

      The type of data returned by the fetcher

    • Error = any

      The type of error that can be thrown

    • Config = any

      The configuration type used to determine blocking behavior

    Index

    Properties

    data: (
        Config extends undefined
            ? false
            : Config extends { suspense: true }
                ? true
                : Config extends { fallbackData: Data | Promise<Data> } ? true : false
    ) extends true
        ? Data
        : Data | undefined

    The data returned by the fetcher function.

    • When suspense is enabled or fallbackData is provided: always defined
    • Otherwise: undefined during initial load or when key is falsy
    error: Error | undefined

    The error object thrown by the fetcher function.

    undefined when there's no error or when a request is in progress.

    Function to mutate the cached data for this specific key.

    This is a bound version of the global mutate function that automatically uses the current key, providing type safety and convenience.

    isValidating: boolean

    Whether the request is currently being validated (loading fresh data).

    true during initial load, revalidation, or when mutate is called with a promise or async function.

    isLoading: boolean

    Whether the request is in initial loading state.

    true only during the initial load when there's no cached data. Unlike isValidating, this becomes false once data is available.