T
TanStack4mo ago
evident-indigo

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
inland-turquoise
inland-turquoise3mo 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...
inland-turquoise
inland-turquoise3mo ago
I see he builds pretty well, but hasn't switched to using the alpha branch yet.
evident-indigo
evident-indigoOP3mo 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
inland-turquoise
inland-turquoise3mo ago
Happy coding!

Did you find this page helpful?