diff --git a/types/graphql-react/graphql-react-tests.tsx b/types/graphql-react/graphql-react-tests.tsx new file mode 100644 index 0000000000..2ebd250332 --- /dev/null +++ b/types/graphql-react/graphql-react-tests.tsx @@ -0,0 +1,47 @@ +import React from "react"; +import { GraphQL, GraphQLContext, useGraphQL } from "graphql-react"; + +const graphql = new GraphQL(); + +function App() { + const { loading, cacheValue } = useGraphQL< + {node: null | {id: string}}, + {id: string} + >({ + fetchOptionsOverride(options) { + options.url = "/graphql"; + }, + variables: { + id: "123456" + }, + operation: { + query: ` + query($id: !String) { + node(id: $id) { + id + } + } + ` + } + }); + + if (loading) { + return