Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 1.94 KB

usequery.md

File metadata and controls

54 lines (42 loc) · 1.94 KB
description layout
Fetch data from Airstack by calling queries to the Airstack API. If you need any pagination, use useQueryWithPagination instead.
title description tableOfContents outline pagination
visible
true
visible
true
visible
true
visible
visible
true

useQuery

Pre-requisites

  • Calling init function

Example

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

const { data, error, loading } = useQuery(query, variables);

Function Signature

function useQuery(
  query: string,
  variables?: Variables,
  configAndCallbacks?: ConfigAndCallabacks
): UseQueryReturnType

Params

Param Type Default Value Description
query string - Airstack API key
variables Variables? null GraphQL query variables
configAndCallbacks ConfigAndCallbacks? null Additional configurations and callbacks.

Responses

Param Type Default Value Description
response UseQueryReturnType - Response from the hook that will return data, error logs, and loading state.