Closed malinskibeniamin closed 9 months ago
TransportProvider
is using React context, so you can use multiple providers, and they will be the default providers used by queries made by components rendered underneath. All of the APIs that use transport also accept transport as an optional argument, so you can override the default.
const queryUsingTransport1 = useQuery(method, undefined, { transport: transport1 });
const mutationUsingTransport2 = useMutation(method, { transport: transport2 });
const infiniteQueryUsingDefaultTransport = useInfiniteQuery(method, { page: 0n }, {
getNextPageParam: (lastPage) => lastPage.page + 1n,
pageParamKey: "page"
});
Closing unless there are any more concerns or questions about multi transport usage.
Currently I am using 1 TransportProvider - is it possible to use more than 1 transport without overriding the previous provider? I would like to choose on a query/mutation basis whether to use a transport #1 or #2, what would be the cleanest way to achieve this?