Function useFetchByKey

  • React Hook for a lookup by key against the /v1/fetch endpoint of the JSON API.

    Type Parameters

    • T extends object
    • K
    • I extends string

    Parameters

    • template: Template<T, K, I>

      The template of the contracts to fetch.

    • keyFactory: () => K

      A function returning the contract key of the contracts to fetch.

    • keyDeps: readonly unknown[]

      Dependencies of this hook (for which the fetch is reexecuted on change).

    Returns FetchResult<T, K, I>

    The fetched contract.

    T The contract template type of the query.

    K The contract key type of the query.

    I The template id type.