refactor(Form): centralize error management
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
||||
export default function useFormatMessage() {
|
||||
const { formatMessage } = useIntl();
|
||||
return (id, values = {}) => formatMessage({ id }, values);
|
||||
|
||||
const customFormatMessage = React.useCallback(
|
||||
(id, values = {}) => formatMessage({ id }, values),
|
||||
[formatMessage],
|
||||
);
|
||||
|
||||
return customFormatMessage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user