TanStackT
TanStack8mo ago
5 replies
worthy-azure

tRPC + Tanstackk Query Wrapper

Does anyone have an example of a wrapper function / hook that returns hooks for mutations and queries? I'm thinking something similar to RTK where you can use the createApi function and inject endpoint, then return useThisMutation useThisQuery. It'd be nice to have a single file for each trpc router that calls the tanstack
useQuery
or
useMutation
, queryKeys defined in that same file also, not have to call the useTRPC and useQueryClient hooks in every component that makes a network request
Was this page helpful?