Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛国际化报错 #6518

Closed
zhuguangyue opened this issue May 3, 2020 · 4 comments
Closed

🐛国际化报错 #6518

zhuguangyue opened this issue May 3, 2020 · 4 comments
Labels

Comments

@zhuguangyue
Copy link

🐛 国际化报错

Warning: Using this API will cause automatic refresh when switching languages, please use useIntl or injectIntl.
image
image

@admiao
Copy link

admiao commented May 3, 2020

#6512

@chenshuai2144
Copy link
Collaborator

chenshuai2144 commented May 4, 2020

你看看 warning 的文档就好了,里面详细描述了为什么

@4kb-wgh
Copy link

4kb-wgh commented Jul 25, 2021

我也遇到国际化的问题。
Warning: Using this API will cause automatic refresh when switching languages, please use useIntl or injectIntl.
函数组件也遇到过,用了useIntl解决了,单这是类组件,怎么解决?
`import { injectIntl, InjectedIntlProps } from "react-intl";
import { formatMessage, useIntl } from 'umi';

class Info extends React.Component {
render(){
return (
{formatMessage({ id: 'register.hk.xs' })} {formatMessage({ id: 'register.hk.ns' })}
)
}
}

export default injectIntl(Info);`

@chenshuai2144

@chenshuai2144
Copy link
Collaborator

直接用组件,不要用静态方法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants