useQuery()
The hooks provided by
@trpc/reactare a thin wrapper around React Query. For in-depth information about options and usage patterns, refer to their docs on Queries.
tsx
tsx
The first argument is a [path, input]-tuple - if the input is optional, you can omit the , input-part.
You'll notice that you get autocompletion on the path and automatic typesafety on the input.
Example
Backend code
server/routers/_app.tstsx
server/routers/_app.tstsx
components/MyComponent.tsxtsx
components/MyComponent.tsxtsx