thomasplayschessT
tRPC3y ago
73 replies
thomasplayschess

Wrapping useQuery into a custom hook

I'm trying to wrap
useQuery
into a custom hook (as I have some legacy code that I need to run before). Example:

trpc.myendpoint.useQuery({ foo: 'bar' });
// instead of the code above, I want to write this:
useCustomHook(trpc.myendpoint, { foo: 'bar' })


I'm able to write the JavaScript code, but I have trouble getting the TypeScript types right. I have more information in the Stackoverflow question here: https://stackoverflow.com/q/77096846

Thanks for any help ❤️
Was this page helpful?