kit
    Preparing search index...

    Type Alias ConfigurationExtended<Data, Error, Fn>

    ConfigurationExtended: SWRConfiguration<Data, Error, Fn> & {
        when?: boolean | (() => boolean);
    }

    Type Parameters

    • Data = any
    • Error = any
    • Fn extends BareFetcher<any> = BareFetcher<any>

    Type Declaration

    • Optionalwhen?: boolean | (() => boolean)

      Conditional fetching as option

      Moving this to an option allows us to keep the endpoints typed dictionary, e.g. we can write:

      const { data, mutate } = myApi.use("User/{id}",
      { params: { id: aVariableMaybeContainingAnId || "" }, },
      { when: !!aVariableMaybeContainingAnId }
      );

      // we still have typed `data`, `mutate`