【问题标题】:Cannot able to import FieldInputProps react-final-form无法导入 FieldInputProps react-final-form
【发布时间】:2020-12-29 14:42:37
【问题描述】:

尝试设置实际的 propTypes。但是显示这样的错误

尝试导入错误:“FieldInputProps”未从“react-final-form”导出。

import { FieldInputProps, FieldMetaState } from 'react-final-form';

const TextInput = ({
  input: { name, onChange, value, type = 'text', placeholder, ...restInput },
  meta
}) => {
  .....Some Component Functionality.....
};

TextInput.propTypes = {
  input: FieldInputProps,
  meta: FieldMetaState
}

不知道为什么会发生这种情况,如何解决?

【问题讨论】:

    标签: reactjs react-proptypes react-final-form final-form


    【解决方案1】:

    在 package.json 中检查您的 react-final-form 版本。我在这个沙盒中没有错误:https://codesandbox.io/s/epic-jennings-i32w6?file=/src/App.js,使用的是 6.5.2

    【讨论】:

    • 我也在用同一个版本,请查看控制台
    猜你喜欢
    • 2021-01-13
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-21
    • 1970-01-01
    相关资源
    最近更新 更多