12 lines
285 B
TypeScript
12 lines
285 B
TypeScript
import { useIntl } from 'react-intl';
|
|
|
|
type Values = {
|
|
[key: string]: any,
|
|
}
|
|
|
|
export default function useFormatMessage(): (id: string, values?: Values) => string {
|
|
const { formatMessage } = useIntl();
|
|
|
|
return (id: string, values: Values = {}) => formatMessage({ id }, values);
|
|
}
|