Closed GloriaCHL closed 4 years ago
可以这么写,用 hooks 才是最香的
interface NameFormProps {
// Include all custom properties here.
}
class NameForm extends React.Component<NameFormProps & InjectedIntlProps, {}> {
// Class body.
}
export default injectIntl(NameForm);
我就是想问 InjectedIntlProps
这个 interface 是从拿来的...可以在你这个demo里写出来一下么。是从 umi 里吗:
import { InjectedIntlProps } from 'umi'
我就是想问
InjectedIntlProps
这个 interface 是从拿来的...可以在你这个demo里写出来一下么。是从 umi 里吗:import { InjectedIntlProps } from 'umi'
在组件的属性里面添加属性 intl:IntlShape;引入import { IntlShape } from 'react-intl';
🧐 问题描述
我现在场景是在一个类组件中使用 intl.formatMessage 函数做多语言处理,但是使用eslint报错了,props里的intl报错了,我不知道给什么类型或者需要继承哪个interface。希望能给个简单的示例。
💻 示例代码
我看 injectIntl 是在 umi 里暴露出来的,但是好像没见 umi 里有暴露 WrappedComponentProps 这个接口,不知道要在哪里找这个 injectIntl 的接口。
🚑 其他信息
报错信息: