@nosto/preact

    Function useCurrencyFormatting

    • Preact hook that formats prices based on supplied currency with a fallback to the default currency.

      Returns { format: (value: number, currency?: string) => string }

      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>
      )
      }
    MMNEPVFCICPMFPCPTTAAATR