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

ParamTypeDefault ValueDescription

query

string

-

Airstack GraphQL query

variables

null

GraphQL query variables

config

{ cache?: boolean }

null

Caching configuration

Responses

ParamTypeDefault ValueDescription

response

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

null

Response object from GraphQL query.

Last updated

Was this helpful?