T
TanStack6mo ago
absent-sapphire

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
4 Replies
genetic-orange
genetic-orange6mo ago
GitHub
GitHub - CarlosZiegler/fullstack-start-template: This project provi...
This project provides a solid foundation for building modern web applications using a curated stack of technologies focused on developer experience, performance, and type safety. - CarlosZiegler/fu...
genetic-orange
genetic-orange6mo ago
I see he builds pretty well, but hasn't switched to using the alpha branch yet.
absent-sapphire
absent-sapphireOP6mo ago
Thank you! I'll check it out Oh yeah, that's a method I was starting to implement. I guess I was on the right path
genetic-orange
genetic-orange6mo ago
Happy coding!

Did you find this page helpful?