import { formatPrice, formatWeight } from "../lib/formatters"; import { useCurrency } from "./useCurrency"; import { useWeightUnit } from "./useWeightUnit"; export function useFormatters() { const unit = useWeightUnit(); const currency = useCurrency(); return { weight: (grams: number | null) => formatWeight(grams, unit), price: (cents: number | null) => formatPrice(cents, currency), unit, currency, }; }