-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
HeroName.tsx
49 lines (45 loc) · 1.92 KB
/
HeroName.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import * as Types from '../types.d.js';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type HeroNameQueryVariables = Types.Exact<{
episode?: Types.InputMaybe<Types.Episode>;
}>;
export type HeroNameQuery = {
__typename?: 'Query';
hero?: { __typename?: 'Droid'; name: string } | { __typename?: 'Human'; name: string } | null;
};
export const HeroNameDocument = gql`
query HeroName($episode: Episode) {
hero(episode: $episode) {
name
}
}
`;
/**
* __useHeroNameQuery__
*
* To run a query within a React component, call `useHeroNameQuery` and pass it any options that fit your needs.
* When your component renders, `useHeroNameQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useHeroNameQuery({
* variables: {
* episode: // value for 'episode'
* },
* });
*/
export function useHeroNameQuery(baseOptions?: Apollo.QueryHookOptions<HeroNameQuery, HeroNameQueryVariables>) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<HeroNameQuery, HeroNameQueryVariables>(HeroNameDocument, options);
}
export function useHeroNameLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<HeroNameQuery, HeroNameQueryVariables>) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<HeroNameQuery, HeroNameQueryVariables>(HeroNameDocument, options);
}
export type HeroNameQueryHookResult = ReturnType<typeof useHeroNameQuery>;
export type HeroNameLazyQueryHookResult = ReturnType<typeof useHeroNameLazyQuery>;
export type HeroNameQueryResult = Apollo.QueryResult<HeroNameQuery, HeroNameQueryVariables>;