如何解决由 redux 表单引起的 Create react app 中的警告?

问题描述

我正在为我的应用程序使用 create react app 并收到多个警告,如下所示。

警告:收到非布尔属性 falsevalid

如果要将其写入 DOM,请改为传递字符串:valid="false" 或 valid={value.toString()}。

enter image description here

我使用的是 redux 表单,下面是我的输入元素组件。

    import React from 'react';
import {Field} from "redux-form";


const renderInput = ({input,Meta,rest,inputProps}) => (<div className="form_input">
    {console.log(Meta)}
            <label htmlFor={inputProps.id}>{inputProps.label}</label>
            <input  {...inputProps} {...input} active="false" {...rest} className="form-control" />
            {Meta.touched && Meta.error && <span className="error">{Meta.error}</span>}
        </div>);

export default function TextArea(props) {
    return (
        <Field name={props.name} inputProps={props} component={renderInput} />
    )
}

调用元素如下

<Input label="Email" name="email" className="form-control" id="email" placeholder="Email" />

如何解决这些警告?

我发现这个链接解决了类似的问题,但我必须修复 redux 表单。

Warning: Received `false` for a non-boolean attribute. How do I pass a boolean for a custom boolean attribute?

任何帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)