Hooks
useCurrency
Detects the user's locale and returns the appropriate currency, symbol, and price formatter.
Usage
const { currency, symbol, formatPrice } = useCurrency()
const label = formatPrice({ usd: 99, eur: 89, gbp: 79 }) // "$99"Installation
npx visor add use-currencyParameters
This hook takes no parameters.
Returns
| Name | Type | Description |
|---|---|---|
currency | 'usd' | 'eur' | 'gbp' | Detected currency code based on browser locale. |
symbol | string | Currency symbol ($, EUR, or GBP). |
formatPrice | (prices: Record<Currency, number>) => string | Formats a price object into a localized string using the detected currency. |