我正在尝试使用redux-form创建表单,但我收到警告和错误,我无法纠正它。这是警告和错误:
1.警告:标记上的未知道具input
,meta
。从元素中删除这些道具。
2.Uncaught Error:input是一个void元素标记,既不能children
也不能使用dangerouslySetInnerHTML
。检查绑定的createElement的render方法。
这是我的代码:
import React, { Component } from 'react';
import { reduxForm,Field } from 'redux-form';
const { DOM: { input, select, textarea } } = React;
class Createstudent extends Component {
render() {
const { handleSubmit } = this.props;
return (
<form onSubmit={handleSubmit}>
<div>
<label>First Name</label>
<Field name="firstName" component={input} type="text"/>
</div>
<div>
<label>Last Name</label>
<Field name="lastName" component={input} type="text"/>
</div>
<div>
<label>Email</label>
<Field name="email" component={input} type="email"/>
</div>
<button type="submit">Submit</button>
</form>
);
}
}
// Decorate the form component
Createstudent = reduxForm({
form: 'contact' // a unique name for this form
})(Createstudent);
export default Createstudent;
答案 0 :(得分:2)