tRPCttRPC
Powered by
Cylonik (Tom)C
tRPC•2y ago•
1 reply
Cylonik (Tom)

Adding trpc.useQuery hook to Next.js page with react-hook-form prevents stateful refresh.

Hi, I'm new to tRPC so apologies if I've worded this poorly. I've got a page with a form managed by react-hook-query and Yup and SWR. I'm trying to migrate over to tRPC and Zod so I've been following the examples. I noticed that stateful refresh was no longer working once I'd added tRPC to the page - form details are no longer retained when making code changes. I found that by removing the following line it started working again.

const hello = trpc.hello.useQuery({text: 'client'});

Why would this be happening and is there a workaround?

I'm using Next 13.5 with Pages and tRPC 11-next-beta.300.

Many thanks, Tom
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Mutation with react-hook-form
VarichVVarich / ❓-help
4y ago
Help with tRPC + Hono + Next.js
Eddy HernándezEEddy Hernández / ❓-help
2y ago
tRPC Express server with Next.js
sumatokenSsumatoken / ❓-help
3y ago