How to use trpc react hooks from an external data source
Hi,
I have a monorepo, nextjs and keystone cms. The cms has trpc running, and I managed to get it connected to my nextjs. Is it possible for example to use the useQuery hook with that connection? Atm I use from "@trpc/react", but it seems to be the same as I would import it from "@trpc/client". See screenshot
Thanks for any help! 🙂
7 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Hi, yes kind of, as the discussion on my other issue states: I have a type error which I cannot fix in a reproductive way. It seems to me that its just a type error as I receive data using the cmsTrpc variable as if there was no error. Although this of course stops me from building...
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Hey, I've uploaded a working nextjs-trpc-keystone example: https://github.com/Westsaid/nextjs-trpc-keystone-example
GitHub
GitHub - Westsaid/nextjs-trpc-keystone-example
Contribute to Westsaid/nextjs-trpc-keystone-example development by creating an account on GitHub.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Thanks for this repo, it was super helpful to me. Have you ever tried enabling tRPC's subscription support via websockets? struggling to get that working inside of Keystone.js's config
Hi, glad it was super helpful for you 😊
Unfortunatly no, didnt touch subscriptions yet