Skip to content

Instantly share code, notes, and snippets.

@hwillson
Last active August 6, 2019 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hwillson/f9330c52bafd6321e47bf9e39572a3eb to your computer and use it in GitHub Desktop.
Save hwillson/f9330c52bafd6321e47bf9e39572a3eb to your computer and use it in GitHub Desktop.
React Apollo 3 - Typescript
import { RocketData, RocketVars } from './types';
const GET_ROCKET_INVENTORY = gql`
query getRocketInventory($year: Int!) {
rocketInventory(year: $year) {
id
year
}
}
`;
export function RocketInventoryList() {
const { loading, data } = useQuery<RocketData, RocketVars>(
GET_ROCKET_INVENTORY,
{ variables: { year: 2019 } }
);
return (/* ... show data ... */);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment