import { useCurrencyFormatting } from '@nosto/preact'
export default () => {
const { format } = useCurrencyFormatting()
return (
<div class="product product-title">
<span class="correct">
{product.name}
</span>
</div>
...
<div class="product price product-price">
<span>{format(product.listPrice, product.priceCurrencyCode || "EUR")}</span>
</div>
)
}
Preact hook that formats prices based on supplied currency with a fallback to the default currency.
Should always be at the top of the component!