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

    Type Alias Arguments

    Arguments: string | ArgumentsTuple | Record<any, any> | null | undefined | false

    Valid types for SWR keys.

    SWR keys identify unique requests and can be:

    • string: Simple URL or identifier
    • ArgumentsTuple: Array with URL and additional parameters
    • Record<any, any>: Object that will be serialized
    • null | undefined | false: Falsy values disable the request

    When a key is falsy, SWR will not make the request, allowing for conditional fetching based on application state.

    // String key
    useSWR('/api/users', fetcher)

    // Array key with parameters
    useSWR(['/api/user', userId], ([url, id]) => fetcher(`${url}/${id}`))

    // Object key
    useSWR({ url: '/api/data', params: { page: 1 } }, fetcher)

    // Conditional key
    useSWR(userId ? `/api/user/${userId}` : null, fetcher)