Bridge React Query
We have created a bridge between react-query and the generated Bridge SDK, enabling you to use react-query seamlessly with the functions from the SDK and handle errors with full type information.
Install bridge-react-query
terminalbash
npm i bridge-react-query@latest# orpnpm add bridge-react-query# oryarn add bridge-react-query
terminalbash
npm i bridge-react-query@latest# orpnpm add bridge-react-query# oryarn add bridge-react-query
Use Bridge Query
client.tsts
import {useBridgeQuery } from 'bridge-react-query';constres =useBridgeQuery (['id'], () =>API .user .getMe ({headers : {token : 'secretToken' } }), {onSuccess : (data ) => {},onError : (error ) => {}})
client.tsts
import {useBridgeQuery } from 'bridge-react-query';constres =useBridgeQuery (['id'], () =>API .user .getMe ({headers : {token : 'secretToken' } }), {onSuccess : (data ) => {},onError : (error ) => {}})
Use Bridge Mutation
client.tsts
import {useBridgeMutation } from 'bridge-react-query';constres =useBridgeMutation (API .user .getMe , {onSuccess : (data ) => {},onError : (error ) => {}})
client.tsts
import {useBridgeMutation } from 'bridge-react-query';constres =useBridgeMutation (API .user .getMe , {onSuccess : (data ) => {},onError : (error ) => {}})
If you require additional react-query functionality to be integrated with Bridge, please ask in our Discord Community.