Registry / ecommerce / react-currency-formatter

react-currency-formatter

JSON →
library1.1.0jsnpmunverified

A React component for formatting currency values using a customizable pattern. Version 1.1.0 supports React 16.x. It provides a simple declarative API with optional props for locale, pattern, decimal, and group separators. Unlike other currency formatters, it uses a pattern string for flexible formatting. However, it is not actively maintained (last update years ago) and has known issues with locale support and TypeScript definitions.

npm install react-currency-formatter
INSTALL
IMPORT
SIG · REACT-CURRENCY-FOR
R
react-currency-formatter
ecommercejavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Currency
import Currency from 'react-currency-formatter'
import { Currency } from 'react-currency-formatter'
Default export; named import causes 'undefined' error.
Currency
const Currency = require('react-currency-formatter').default
const Currency = require('react-currency-formatter')
CJS users must use .default; otherwise Value is undefined.
Currency
import Currency from 'react-currency-formatter'
TypeScript: no type definitions shipped; use @types/react-currency-formatter if available.

Shows basic usage of the Currency component with a quantity, currency code, and locale.

import React from 'react'; import Currency from 'react-currency-formatter'; function App() { return ( <Currency quantity={1234.56} currency="EUR" locale="de-DE" /> ); } export default App;
Debug
Known issues
gotchalocale prop does not fully respect standard locale strings; behavior varies across browsers.
fix
Use pattern, decimal, group props for consistent formatting or test with target locales.
affects: >=1.0.0
gotchaNo TypeScript type definitions included; may require custom declarations.
fix
Create a .d.ts file: declare module 'react-currency-formatter' { const Currency: any; export default Currency; }
affects: >=1.0.0
deprecatedPackage is unmaintained; last release 2018. No support for React 17+ Hooks or concurrent mode.
fix
Consider using Intl.NumberFormat directly or a maintained alternative like react-number-format.
affects: >=1.0.0
gotchaUsing pattern override may break locale-specific formatting; pattern is applied before locale.
fix
Avoid pattern when locale is set; or test thoroughly.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'default' of undefined
CommonJS require without .default
fix
Use require('react-currency-formatter').default or switch to import syntax.
Warning: React does not recognize the `locale` prop on a DOM element.
locale prop passed to underlying <span> without filtering.
fix
Upgrade to a patched version or fork and filter unknown props.
Module not found: Can't resolve 'react-currency-formatter'
Package not installed or peer dependency missing.
fix
npm install react-currency-formatter --save
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
reactrequiredPeer dependency; requires React 16.x
Agent activity
23 hits · last 30 days
node
20
Resources
react-currency-formatter — npm install react-currency-formatter · libregistry