Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface QueryOptions<TData, TVariables, CacheKey>

Options of useQuery

Type parameters

Hierarchy

  • CommonHookOptions<TData, TVariables>
    • QueryOptions

Index

Properties

Optional fetchPolicy

fetchPolicy: FetchPolicy

Fetch policy used for the query hook.

If not specified, by default is "cache-first", but if lazy is true, it's default is "cache-and-network"

Optional fetchTimeout

fetchTimeout: undefined | number

Fetch timeout time, by default it's 10000 ms

Optional headers

headers: Headers

Headers added to the fetch call

Optional lazy

lazy: undefined | false | true

Specify lazy behaviour of the query.

Wait until explicit query call.

It also disables sharedCacheId behaviour

Optional notifyOnNetworkStatusChange

notifyOnNetworkStatusChange: undefined | false | true

Whether the hook should re-render when it's fetching after a refetch and change it's fetchState to "loading"

By default it's set to true

Optional onCompleted

onCompleted: undefined | ((data: Maybe<TData>) => void)

Event called on every successful hook call. Including cache updates, setData calls, and successful network calls.

(data: Maybe) => void

Optional onError

onError: undefined | ((errors: GraphQLError[]) => void)

Event called on GraphQL error on hook call.

Optional pollInterval

pollInterval: undefined | number

Activate and specify milliseconds polling interval of the hook call;

Optional sharedCacheId

sharedCacheId: CacheKey

Shared hook cache id

In order to be able to sync different query hooks data you can specify a shared cache id between those hooks which will update each other data.

This cache id also works as in memory persistence across different hook instances of the same hook, across navigating through different pages for example.

Optional skip

skip: undefined | false | true

Skip automatic query hook call if it's set to true

This option only works if lazy is false or not specified

Optional variables

variables: TVariables

Variables used in the hook call.

Hook automatically called on any variable change in useQuery.

Generated using TypeDoc