useLazyQuery

Manually trigger data fetching from Airstack by calling queries to the Airstack API. If you need any pagination, use useLazyQueryWithPagination instead.

Pre-requisites

  • Calling init function

Example

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

const [fetch, { data, error, loading }] =
  useLazyQuery(query, variables, configAndCallbacks);

Function Signature

function useLazyQuery(
  query: string,
  variables?: Variables,
  configAndCallbacks?: ConfigAndCallbacks
): useLazyQueryReturnType

Params

ParamTypeDefault ValueDescription

query

string

-

variables

null

GraphQL query variables

configAndCallbacks

null

Additional configurations and callbacks.

Responses

ParamTypeDefault ValueDescription

response

-

Response from the hook that will return an execute function, data, error logs, and loading state.

Last updated

Was this helpful?