Skip to content

Broken Validation when using React Elements for Messages #2

Open
@dairyisscary

Description

@dairyisscary

Version Number

7.43.2

Codesandbox/Expo snack

n/a

Steps to reproduce

hello react-hook-form folks!

28cafa864b4a92b2d2f6ac8f5c5cb27722e38b3f removed the option to use react elements as validation messages. as a result internationalization libraries that use elements for translation of validation messages no longer work.

For example, with react-intl/formatjs:

<input type="text" {...form.register("name", { required: <FormattedMessage defaultMessage="this is required" /> })} />

most internationalization libraries (including formatjs) can produce strings but the element api is often more convenient, can use constant values, and doesn't require boilerplate to get things out of context

Expected behaviour

hopefully we can bring this back.

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions