익명 함수를 사용하여 구성 요소를 정의하면 값이 전송 처리기로 전달되지 않습니다. 나는 다음과 같은 간단한 형태로 만들어 REDUX 형태 6.0.5값이 redux-form의 submit 함수에 전달되지 않음 6.0.5
을 사용하고 있습니다 :
이class TestForm extends Component {
constructor(props) {
super(props);
}
submit(e) {
console.log(e);
}
renderField(field) {
return (
<input {...field.input} type="text" className="form-control" placeholder={field.placeholder} />
);
}
render() {
const handleSubmit = this.props.handleSubmit;
return (
<form onSubmit={handleSubmit(this.submit)}>
<div className="form-group">
<label>Title</label>
<Field name="title"
placeholder="Title"
component={this.renderField} />
</div>
<div className="form-group">
<label>Category</label>
<Field name="category"
placeholder="Category"
component={category => (
<input type="text" className="form-control" {...category}/>
)
} />
</div>
<button type="submit" className="btn btn-primary">Submit</button>
</form>
);
}
}
제출하면 (e)는이라고, 콘솔 제목 필드의 값을 표시를하지만 범주에 대한 가치 표시됩니다.
카테고리 필드에 내 익명 기능에 문제가 있습니까? 아니면 익명의 기능이 구성 요소로 지원되지 않습니까?