【问题标题】:How use react-i18next withNamespaces in antd forms如何在 antd 表单中使用 react-i18next withNamespaces
【发布时间】:2019-03-04 14:59:18
【问题描述】:

我是 i18next 打字稿的新手,我想使用 withNamespaces 翻译一个 antd 表单

export default withNamespaces()(Form.create()(MyComponent));

这给了我以下错误:

Argument of type 'ComponentClass<RcBaseFormProps & Pick<any, string | number | symbol>, any>' is not assignable to parameter of type 'ComponentType<WithNamespaces>'. Type 'ComponentClass<RcBaseFormProps & Pick<any, string | number | symbol>, any>' is not assignable to type 'ComponentClass<WithNamespaces, any>'. Type 'RcBaseFormProps & Pick<any, string | number | symbol>' is missing the following properties from type 'WithNamespaces': tReady, i18n, t

这样做的正确方法是什么?谢谢。

【问题讨论】:

    标签: reactjs typescript antd i18next


    【解决方案1】:

    如果有人有同样的问题可以使用recompose包。

    https://github.com/acdlite/recompose

    然后做这样的事情:

    import { compose} from 'recompose'
    
    {...}
    
    export default compose(withNamespaces())(Form.create()(MyComponent))
    
    

    【讨论】:

      猜你喜欢
      • 2019-08-16
      • 2019-04-08
      • 2022-06-10
      • 2020-03-01
      • 2021-05-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-12
      • 1970-01-01
      相关资源
      最近更新 更多