useGraphQLIntrospection
useGraphQLIntrospection(
options?):UseQueryResult<undefined|object,Error>
Hook to fetch the GraphQL schema via introspection
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? | object | Query options |
options.enabled? | boolean | - |
options.requestOptions? | GraphQLRequestOptions | - |
options.staleTime? | number | - |
Returns
Section titled “Returns”UseQueryResult<undefined | object, Error>
React Query result with schema introspection data
Example
Section titled “Example”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> )}