React Query
Zeus can generate type-safe versions of React queries useQuery
, useMutation
etc. and React hooks as useTypedQuery
, useTypedMutation
etc. by simply adding the --reactQuery
flag to the CLI. All types 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>;
};
Last updated
Was this helpful?