Skip to content

getExchangeRate

This custom React hook allows you to request the exchange rate between two currency codes (e.g., "USDT" to "NGN"), track the loading state and handle errors.

Code Example

Simple code example of how to use the hook:

typescript
const {
  getExchangeRate,
  rate,
  isPending,
  error
} = useGetExchangeRate(config);

useEffect(() => {
  getExchangeRate({ from: 'USDT', to: 'NGN' });
}, []);