JSFiddle - React, Tailwind, and code Playground
HTML
<p>Default</p>
<div class="price"></div>
<p>Price with zeroes(should become € 135)</p>
<div class="price-zeroes"></div>
<p>Price with a single zero(should still work as before)</p>
<div class="price-with-one-zero"></div>
Babel + JSX
const currency = 'EUR';
const language = 'NL';
var localePrice = (amount) => {
const options = {
style: 'currency',
currency: currency
};
return amount.toLocaleString(language, options);
}
document.querySelector('.price').innerHTML = localePrice(135.21);
document.querySelector('.price-zeroes').innerHTML = localePrice(135.00);
document.querySelector('.price-with-one-zero').innerHTML = localePrice(135.30);