[英]How handle "missing message" error in react-intl?
I'm using react-intl version 2.4.0 and for some translations I receive "missing message" error in console.我正在使用 react-intl 2.4.0 版,对于某些翻译,我在控制台中收到“缺少消息”错误。 Is there any way to handle them without upgrading to v3?
有没有办法在不升级到 v3 的情况下处理它们?
<IntlProvider
locale="ru"
messages={localeData.ru}
>
<Layout>
<Component {...props} />
</Layout>
</IntlProvider>
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.我没有在 GH 上读过那个问题,但是如果你滚动到底部,你会看到现在有一个
onError
道具(从 v2.7.1 开始)来提供自定义错误处理程序。
<IntlProvider onError={myCustomErrorFunction} />
Provide your own error handler (without a console.error
) and the console error should go away.提供您自己的错误处理程序(没有
console.error
),控制台错误应该消失。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.