Skip to content

useGraphQLIntrospection

useGraphQLIntrospection(options?): UseQueryResult<undefined | object, Error>

Hook to fetch the GraphQL schema via introspection

ParameterTypeDescription
options?objectQuery options
options.enabled?boolean-
options.requestOptions?GraphQLRequestOptions-
options.staleTime?number-

UseQueryResult<undefined | object, Error>

React Query result with schema introspection data

function SchemaExplorer() {
const { data, isLoading } = useGraphQLIntrospection()
if (isLoading) return <div>Loading schema...</div>
return (
<div>
<p>Query type: {data?.__schema.queryType.name}</p>
<p>Types: {data?.__schema.types.length}</p>
</div>
)
}