fetchQuery

Fetch data from Airstack by calling queries to the Airstack API. If you need any pagination, use fetchQueryWithPagination instead.

Pre-requisites

  • Calling init function

Example

import { fetchQuery } from "@airstack/airstack-react";

const { data, error } = await fetchQuery(query, variables, config);

Function Signature

fetchQuery(
  query: string,
  variables?: Variables,
  config: Config
): Promise<Pick<FetchQuery, "data" | "error">>

Params

Param
Type
Default Value
Description

query

string

-

Airstack GraphQL query

variables

null

GraphQL query variables

config

{ cache?: boolean }

null

Caching configuration

Responses

Param
Type
Default Value
Description

response

Promise<Pick<FetchQuery, "data" | "error">>

null

Response object from GraphQL query.

Last updated

Was this helpful?

#946:

Change request updated