Hello again, do convex have any examples
Hello again, do convex have any examples with NextJS, @tanstack/react-query and prefetching on a server?
I'm getting error from
convex/react
:
8 Replies
In Next.js any useQuery using a Convex function needs to be in a client component, regardless of whether it's used with React Query or not.
Okay. Can I use
queryClient.setQueryData
together with prefetchQuery
? See only one obstacle is hashFn
used for queryKey. But accordingly to source code implementation isn't complexYeah you can!
You can export that hashFn too
Would love to see an example, we could use one in the https://github.com/get-convex/convex-react-query repo
I managed to implement prefetched @tanstack/react-queries with nextjs! I would love to share some minimal example code, do you have dedicated repo for examples to make PR?
fully working code with convex-auth, nextjs and tanstack query.
w/o any changes on client side — pure convex + react-query approach from docs
On option is an example in the convex-react-query repo