How conversion works
The core calculation is a single formula applied incalculoCrypto:
converterCrypto.jsx
input— the amount the user typed in the number fieldprecioFrom— the USD price of the source asset (e.g.bitcoin.usd)cantidadTo— the USD price of the target asset (e.g.usd.usd= 1)
State variables
| Variable | Initial value | Description |
|---|---|---|
input | 1 | The numeric amount entered by the user |
priceFrom | response.bitcoin.usd | USD price of the selected source asset |
amountOf | response.usd.usd | USD price of the selected target asset |
loading | true | Controls the loading spinner visibility |
convertApi | {} | Full price map returned by keepPrice() |
Supported assets
Prices are fetched for the following assets from the CoinGecko/simple/price endpoint:
Fiat
USD
Cryptocurrencies
Bitcoin, Ethereum, Solana, Cardano, Tether, BNB (Binance Coin)
bitcoin, usd) are used directly to populate both dropdown menus, so the selects always stay in sync with what the API returns.
Data loading
Rates are loaded once on mount viakeepPrice() from cache.js:
converterCrypto.jsx
Loading state
While rates are being fetched, a small animated spinner is shown in place of the converter form:converterCrypto.jsx
loading is false the full converter UI is rendered.