Zeus can generate type-safe versions of React Query's useQuery
, useMutation
etc.. React hooks as useTypedQuery
, useTypedMutation
etc... by adding the --reactQuery
flag to the CLI. All types data
response 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>;
};