next.js/examples/with-graphql-hooks/src/client-components/repo-list.tsx
repo-list.tsx18 lines377 B
import { useQuery } from "graphql-hooks";

const getRepo = /* GraphQL */ `
  query {
    launchLatest {
      mission_name
    }
  }
`;

export function RepoList() {
  const { loading, error, data } = useQuery(getRepo);
  if (loading) return <p>Loading...</p>;
  if (error) return <p>Error: {JSON.stringify(error)}</p>;

  return <div>{data.launchLatest.mission_name}</div>;
}
Quest for Codev2.0.0
/
SIGN IN