npm install react-currency-format --save --force //Install on your project.
//Import On Your project
//ES6
import CurrencyFormat from 'react-currency-format';
//ES5
const CurrencyFormat = require('react-currency-format');
//Typescript
import * as CurrencyFormat from 'react-currency-format';
//Usage Example
<CurrencyFormat
renderText={(value) => (
<>
//Your Code.
</>
)}
decimalScale={2}
value={0}
displayType={'text'}
prefix={'$'}
/>
const priceSplitter = (number) => (number && number.toString().replace(/B(?=(d{3})+(?!d))/g, ','));
console.log(priceSplitter(72500));
Run code snippet
<CurrencyFormat value={4111111111111111} displayType={'text'} format="#### #### #### ####" />
<CurrencyFormat thousandSeparator={true} prefix={'$'} />