FetchQuery

The return type of the fetchQuery function comprises of the data, error logs, loading indicator, and pagination object.

Example

{
  "data": {},
  "error": {},
  "hasNextPage": true,
  "hasPrevPage": true,
  "getNextPage": () => {},
  "getPrevPage": () => {}
}

Type Signature

type FetchQuery = {
  data: any;
  error: any;
  hasNextPage: boolean;
  hasPrevPage: boolean;
  getNextPage: () => Promise<FetchQuery | null>;
  getPrevPage: () => Promise<FetchQuery | null>;
};

Fields

ParamTypeDefault ValueDescription

data

any?

null

Response data from GraphQL query if API call succeeds.

error

any?

null

Error logs from GraphQL query if API call failed.

hasNextPage

boolean

false

Indicate if there is any next page.

hasPrevPage

boolean

false

Indicate if there is any previous page.

getNextPage

() => Promise<FetchQuery | null>

-

Function to get data in the next page.

getPrevPage

() => Promise<FetchQuery | null>

-

Function to get data in the previous page.

Last updated

Was this helpful?