w7tf
Is it possible to use tRPC React Query Integration without defining a trpc provider?
When using react query without tRPC the query client can be passed as an argument when using the hook. Example:
const { data: inquiries } = useQuery(
{
initialData: data,
queryKey: ["data"],
queryFn: async () => await fn(),
},
queryClient,
);
Now my question would be if it is possible to pass the trpcClient in a similar manner to a tRPC wrapped useQuery / useMutation hook.
For those wondering why: Astro's island architecture breaks the ability to use providers. It would be possible to wrap each island with a provider but passing the client would make it much easier.
2 replies