T
Join ServertRPC
❓-help
Fetching different server url than defined in config
Is it possible to access the reactQuery instance and fetch different server url? I would like to use reactQuery to get data from my server which is at say
/address-middleware
instead of hitting /trpc/....
Can I do that? I dont want to setup separate reactquery provider or something just to call one separate endpointYes you can use React Query
but how I could fetch different url than the one which is defined via createTRPCReact -> /trpc
A query function can fetch any way you desire. See the Tanstack Query useQuery docs for examples. On the tRPC side, everything you need to know should be here (mostly relevant is the example of getting the query client)
https://trpc.io/docs/useContext#helpers
https://trpc.io/docs/useContext#helpers