fetchQueryWithPagination

Fetch data from Airstack by calling queries to the Airstack API with pagination included. If you don't need pagination, use fetchQuery instead.

Pre-requisites

  • Calling init function

Example

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

const { data, error, hasNextPage, hasPrevPage, getNextPage, getPrevPage } =
  await fetchQueryWithPagination(query, variables, config);

Function Signature

function fetchQueryWithPagination(
  query: string,
  variables?: Variables,
  config?: { cache?: boolean }
): Promise<FetchQuery>

Params

ParamTypeDefault ValueDescription

query

string

-

Airstack GraphQL query

variables

null

GraphQL query variables

config

{ cache?: boolean }

null

Caching configuration

Responses

ParamTypeDefault ValueDescription

response

Promise<FetchQuery>

null

Response object from GraphQL query.

Last updated

Was this helpful?