MCPcopy Index your code
hub / github.com/code-with-antonio/nodebase / TRPCReactProvider

Function TRPCReactProvider

src/trpc/client.tsx:33–60  ·  view source on GitHub ↗
(
  props: Readonly<{
    children: React.ReactNode;
  }>,
)

Source from the content-addressed store, hash-verified

31 return `${base}/api/trpc`;
32}
33export function TRPCReactProvider(
34 props: Readonly<{
35 children: React.ReactNode;
36 }>,
37) {
38 // NOTE: Avoid useState when initializing the query client if you don't
39 // have a suspense boundary between this and the code that may
40 // suspend because React will throw away the client on the initial
41 // render if it suspends and there is no boundary
42 const queryClient = getQueryClient();
43 const [trpcClient] = useState(() =>
44 createTRPCClient<AppRouter>({
45 links: [
46 httpBatchLink({
47 transformer: superjson,
48 url: getUrl(),
49 }),
50 ],
51 }),
52 );
53 return (
54 <QueryClientProvider client={queryClient}>
55 <TRPCProvider trpcClient={trpcClient} queryClient={queryClient}>
56 {props.children}
57 </TRPCProvider>
58 </QueryClientProvider>
59 );
60}

Callers

nothing calls this directly

Calls 2

getQueryClientFunction · 0.85
getUrlFunction · 0.85

Tested by

no test coverage detected