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.