如何处理 react-intl 中的 "missing message" 错误?
How handle "missing message" error in react-intl?
我使用的是 react-intl 版本 2.4.0,对于某些翻译,我在控制台中收到 "missing message" 错误。有没有办法在不升级到 v3 的情况下处理它们?
<IntlProvider
locale="ru"
messages={localeData.ru}
>
<Layout>
<Component {...props} />
</Layout>
</IntlProvider>
我没有在 GH 上读到那个问题,但是如果你滚动到底部,你会看到现在有一个 onError
prop(从 v2.7.1 开始)提供一个自定义错误处理程序。
<IntlProvider onError={myCustomErrorFunction} />
提供您自己的错误处理程序(没有 console.error
),控制台错误应该会消失。
我使用的是 react-intl 版本 2.4.0,对于某些翻译,我在控制台中收到 "missing message" 错误。有没有办法在不升级到 v3 的情况下处理它们?
<IntlProvider
locale="ru"
messages={localeData.ru}
>
<Layout>
<Component {...props} />
</Layout>
</IntlProvider>
我没有在 GH 上读到那个问题,但是如果你滚动到底部,你会看到现在有一个 onError
prop(从 v2.7.1 开始)提供一个自定义错误处理程序。
<IntlProvider onError={myCustomErrorFunction} />
提供您自己的错误处理程序(没有 console.error
),控制台错误应该会消失。