import { useCallback } from 'react'; import { FormattedDate, FormattedMessage, IntlFormatters, useIntl, IntlProvider } from 'react-intl'; /** * Use this instead of the default function from `react-intl`. * Keep props identical to the original `FormattedMessage`. * * Don't add complicated `values` in this hook as they're changing too much with the new theme. * Just add it in your specific use case. */ export const useFormatMessage = (): { formatMessage: ( descriptor: Parameters[0], values?: Parameters[1], ) => React.ReactNode; } => { const { formatMessage: formatMessageBase } = useIntl(); const formatMessage = useCallback( ( descriptor: Parameters[0], values?: Parameters[1], ) => { return formatMessageBase( { ...descriptor }, { b: (chunks) => {chunks}, br:
, li: (chunks) =>
  • {chunks}
  • , p: (chunks) =>

    {chunks}

    , span: (chunks) => {chunks}, ...values, }, ); }, [formatMessageBase], ); return { formatMessage }; }; export { FormattedDate, FormattedMessage, IntlProvider, useIntl };