道具类型失败:提供给“字段”的道具“组件”无效。安装 mui v4 后

Failed prop type: Invalid prop `component` supplied to `Field`. after installing mui v4

迁移到 Material ui v4 并遇到此错误

Failed prop type: Invalid prop component supplied to Field. in Field (created by TextField)

其中指向redux表单域组件

export const TextField = props => (
    <Field
        component={renderTextField}
        {...props}
    />
);

在查看 docs

时,我认为这与 React.forwardRef 有关

尝试过

1.)

添加后 Redux 表单指向 forwardRef : boolean [optional] ,问题仍然存在

 <Field
     component={renderTextField}
     forwardRef={true}
     {...props}
  />

2.)

component= {React.forwardRef((props, ref) => <renderTextField innerRef={ref} {...props} />)}

这是无效的。

您必须使用“最新的”redux 表单包,该包具有 React.forwardRef 实现。

安装 8+

"redux-form": "^8.3.6"