gpt4 book ai didi

javascript - 如何处理 react-intl 中的 "missing message"错误?

转载 作者:行者123 更新时间:2023-12-03 07:25:23 25 4
gpt4 key购买 nike

我正在使用 react-intl 2.4.0 版,对于某些翻译,我在控制台中收到“缺少消息”错误。有没有办法在不升级到 v3 的情况下处理它们?

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

enter image description here

最佳答案

我没有在 GH 上阅读过这个问题,但如果你滚动到底部,你会看到现在有一​​个 onError prop。 (从 v2.7.1 开始)提供自定义错误处理程序。

   <IntlProvider onError={myCustomErrorFunction} />

提供您自己的错误处理程序(没有 console.error ),控制台错误应该会消失。

关于javascript - 如何处理 react-intl 中的 "missing message"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59388275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com