Build the Currency Converter
25 min read
Calculate the Receive Amount
Calculate the Receive Amount
In components/Converter.js, use the shared getRate helper and derive the receive amount from the current send amount.
const rate = getRate(fallbackRates, from, to);
const result = Number(amount || 0) * rate;
Keep the receive field read-only because it represents derived data.
Test it
Enter 1000 and switch between currency pairs. The receive value should update immediately.
Checkpoint
The converter now has a complete local calculation path from input amount to output amount.