0
私は、反応型と還元型を使用して簡単なログインフォームを作成しています。 フォームに入力された値をコンソール化しようとすると、定義されません。フォームの値をredux形式で取得できませんか?
import React, { Component } from 'react';
import { reduxForm } from 'redux-form';`enter code here`
class Signin extends Component {
handleFormSubmit({email, password}){
console.log(email,password);
// this.props.signinUser({email,password});
}
render(){
const { handleSubmit, fields: { email, password }} = this.props;
return (
<form onSubmit={handleSubmit(this.handleFormSubmit.bind(this))}>
<fieldset className="form-group">
<label>Email:</label>
<input className="form-control" {...email} />
</fieldset>
<fieldset className="form-group">
<label>Password:</label>
<input className="form-control" {...password} />
</fieldset>
<button action="submit" className="btn btn-primary">Sign in</button>
</form>
);
}
}
export default reduxForm({
form: 'signin',
fields: ['email', 'password']
})(Signin);