react-intlayer
Version:
Easily internationalize i18n your React applications with type-safe multilingual content management.
32 lines (30 loc) • 943 B
TypeScript
import * as _intlayer_types10 from "@intlayer/types";
//#region src/client/format/useNumber.d.ts
/**
* React client hook that provides a localized number formatter.
*
* Uses the current locale from {@link useLocaleBase} and returns
* a function that can be used to format numbers consistently
* according to the user's locale.
*
* @example
* ```tsx
* const formatNumber = useNumber();
*
* formatNumber(12345);
* // e.g. "12,345" (en-US)
* // e.g. "12 345" (fr-FR)
*
* formatNumber(0.75, { style: "percent" });
* // e.g. "75%"
* ```
*
* @returns {(value: string | number, options?: import("../createNumber").NumberProps) => string}
* A number formatting function bound to the active locale.
*/
declare const useNumber: () => (value: string | number, options?: Intl.NumberFormatOptions & {
locale?: _intlayer_types10.LocalesValues;
}) => string;
//#endregion
export { useNumber };
//# sourceMappingURL=useNumber.d.ts.map