Log in to GraphQL Editor
Docs
Projects Cloud

React Query | Zeus GraphQL TypeScript generator

Zeus can generate type-safe versions of React queries useQuery, useMutation etc. as well as React hooks as useTypedQuery, useTypedMutation etc. To do so simply add the --reactQuery flag to the CLI. All types of data responses are then inherited from the Zeus query. 🚀

$ zeus schema.graphql ./  --reactQuery
import { useTypedQuery } from './zeus/reactQuery';

const Main = () => {
  const { data } = useTypedQuery({
    // Get autocomplete here:
    drawCard: {
      name: true,
    },
  });
  // data response is now typed
  return <div>{data.drawCard.name}</div>;
};