Last active
April 25, 2018 19:45
-
-
Save n1te1337/238052193fdf444c133d38a6fdccdb5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { reduxForm, Field } from 'redux-form'; | |
class Signin extends Component { | |
onSubmit({ email, password }) { | |
console.log(email); | |
console.log(password); | |
} | |
renderField(field) { | |
return ( | |
<fieldset className="form-group"> | |
<label>{field.label}:</label> | |
<input | |
className="form-control" | |
type={field.type} | |
{...field.input} | |
/> | |
</fieldset> | |
); | |
} | |
render() { | |
return ( | |
<form onSubmit={this.props.handleSubmit(this.onSubmit.bind(this))}> | |
<Field | |
name="email" | |
label="Email" | |
type="text" | |
component={this.renderField} | |
/> | |
<Field | |
name="password" | |
label="Password" | |
type="password" | |
component={this.renderField} | |
/> | |
<button action="submit" className="btn btn-primary">Sign in</button> | |
</form> | |
); | |
} | |
} | |
export default reduxForm({ | |
form: 'signin', | |
})(SignIn); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment