使用 redux 表单时控制台中的未知道具消息

unknown props message in console while using redux form

我在 React 应用程序中使用 redux 形式。我在控制台呈现表单时面临此警告

warning: Unknown props `initialValue`, `autofill`, `onUpdate`, `valid`, `invalid`, `dirty`, `pristine`, `active`, `touched`, `visited`, `autofilled` on <input> tag. Remove these props from the element.

如何解决 redux 形式的这个警告

这个警告是 introduced in React 15.2.0 to prevent people from passing down unnecessary or invalid props. Redux form did this, which probably is why you see the warning. There's a closed issue for it on their issue tracker on GitHub if you want to read more. It should be fixed in this version,所以尝试更新,警告应该会消失。

const renderField = field => (
  <div>
    <input {...field.input}/>
                 // ^^^^^^------------------ THAT is all you have to add. 
    {field.touched && field.error && <span>{field.error}</span>}
  </div>
)