9

I'm using react-intl version 2.4.0 and for some translations I receive "missing message" error in console. Is there any way to handle them without upgrading to v3?

<IntlProvider
        locale="ru"
        messages={localeData.ru}
      >
        <Layout>
          <Component {...props} />
        </Layout>
      </IntlProvider>

enter image description here

Yerlan Yeszhanov
  • 2,149
  • 12
  • 37
  • 67

1 Answers1

16

I had not read that issue on GH, but if you scroll to the bottom you'll see there is now an onError prop (as of v2.7.1) to provide a custom error handler.

   <IntlProvider onError={myCustomErrorFunction} />

Provide your own error handler (without a console.error) and the console error should go away.

Brett DeWoody
  • 59,771
  • 29
  • 135
  • 184