{"version":"1.0","type":"rich","title":"Hook that formats a number as a currency using the browser's locale.","description":"This example shows a React hook that formats a numeric value as a currency string according to the browser’s locale. It uses the `Intl.NumberFormat` API to apply locale-specific formatting, and maps the locale’s country code to a currency code (e.g., `IN` to `INR`, `JP` to `JPY`) via a lookup table, defaulting to `USD` when no match exists. The hook relies on `useMemo` to cache both the formatter and the formatted output, recomputing only when the locale or value changes. It takes a `value` and an optional `locale` (defaulting to `navigator.language`) and returns the formatted currency string.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-7a3f470ea8bea54ad877067121244340?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}