next.js/examples/with-apollo/src/components/LatestMissionName.tsx
LatestMissionName.tsx26 lines546 B
import { getClient } from "@/lib/ApolloClient";
import { TypedDocumentNode, gql } from "@apollo/client";

export const getLatestMissionName: TypedDocumentNode<{
  launchLatest: {
    mission_name: string;
  };
}> = gql`
  query {
    launchLatest {
      mission_name
    }
  }
`;

/**
 * Example Server Component that uses Apollo Client for data fetching.
 */
export async function LatestMissionName() {
  const { data } = await getClient().query({
    query: getLatestMissionName,
  });

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