Automatically convert your app's prices to local user currency
A

Automatically convert your app's prices to local user currency

Automatically convert your app's prices to local user currency

16 stars
N/A forks
N/A contributors

README

Project documentation from GitHub

Localize Your App's Prices Without the Headache

If you're selling anything in your app, you know the drill. A user from Japan sees a price in USD, does the mental math, and maybe decides it's not worth the friction. You could build a complex backend service to fetch exchange rates, manage caching, and format currencies correctly for every locale. Or, you could let a component handle it.

That's the idea behind react-currencynet. It's a lightweight React hook and component that automatically converts and displays your application's prices into your user's local currency. It pulls live exchange rates so you don't have to.

What It Does

In short, react-currencynet takes a base price (like 10.99 in USD) and automatically converts it to the currency of whoever is using your app. It detects the user's locale and fetches the current exchange rate from a reliable API. The result is a formatted price string that feels native to the user—think ¥1,580 instead of $10.99.

It handles the formatting rules for you: the correct currency symbol, decimal places, and thousand separators that vary from country to country.

Why It's Cool

The clever part is in the simplicity. You wrap your app with a provider, pass in your base currency, and then use the useCurrency hook anywhere. It manages the rate-fetching logic, caching, and error states internally. You just ask for the converted price.

It's also privacy-conscious. The locale detection happens on the client-side via the browser's Internationalization API (Intl). No need to send the user's location to your server unless you want to. The exchange rate fetching is efficient, using a free tier of a currency API (and you can easily plug in your own preferred service if needed).

For developers, it means you can stop hardcoding currency symbols and manually managing exchange rate tables. It makes your app feel instantly more global with just a few lines of code.

How to Try It

Getting started is straightforward. Install the package via npm:

npm install react-currencynet

Then, wrap the relevant part of your app with the CurrencyProvider and use the hook:

import { CurrencyProvider, useCurrency } from 'react-currencynet'; function App() { return ( <CurrencyProvider baseCurrency="USD"> <ProductCard /> </CurrencyProvider> );
} function ProductCard() { const { convertPrice, formatted } = useCurrency(); const price = 10.99; // formatted returns a string like "€10.50" // convertPrice returns the numerical value return <h3>Price: {formatted(price)}</h3>;
}

Check out the

Did you like this issue?

Join our weekly newsletter

Love discovering amazing projects?

Help us continue bringing you the best open-source discoveries every week.

Back to Projects
Last updated: Mar 28, 2026