Haunted: useQuery
Apollo useQuery
hook for web components. Elements that call useQuery
inherit the ApolloQueryInterface
.
Read the query component guides for examples and tips.
Exports
import { useQuery } from '@apollo-elements/haunted/useQuery';
useQuery
Parameters
query
TypedDocumentNode|DocumentNode
options
QueryHookOptions<D, V>
Option | Type | Description |
---|---|---|
client |
|
ApolloClient instance use to make the call. |
context |
|
Context object passed through the link execution chain. |
errorPolicy |
|
Error policy to use for the mutation. See errorPolicy |
fetchPolicy |
|
See fetchPolicy |
nextFetchPolicy |
|
See nextFetchPolicy |
noAutoSubscribe |
|
See noAutoSubscribe |
notifyOnNetworkStatusChange | See notifyOnNetworkStatusChange |
|
onCompleted |
|
Callback for when the query resolves. |
onError | See onError |
Callback for when an error occurs. |
partialRefetch |
|
See partialRefetch |
pollInterval |
|
See pollInterval |
query |
|
A GraphQL document that consists of a single query to be sent down to the server. |
returnPartialData |
|
See returnPartialData |
shouldSubscribe | See shouldSubscribe |
Predicate which determines whether or not to automatically subscribe |
variables |
|
A map going from variable name to variable value, where the variables are used within the GraphQL query. |
Returns
QueryResult<D, V>
Property | Type | Description |
---|---|---|
data |
|
Latest query data. |
error |
|
See error |
loading |
|
Whether the request is in-flight. |
refetch | See refetch |
|
client |
|
ApolloClient instance use to make the call. |
called |
|
Relevant to subscriptions only. |
fetchMore | See fetchMore | |
networkStatus |
|
See networkStatus |
variables |
|
Query variables used in the call. |
startPolling |
|
Call to start polling the query. |
stopPolling |
|
Call to stop polling the query. |
subscribeToMore | See subscribeToMore |