Skip to content

Instantly share code, notes, and snippets.

@slopeofhope81
Forked from n1te1337/signin.js
Created April 25, 2018 19:45
Show Gist options
  • Save slopeofhope81/235649db56603f4ba4968452d100e1e4 to your computer and use it in GitHub Desktop.
Save slopeofhope81/235649db56603f4ba4968452d100e1e4 to your computer and use it in GitHub Desktop.
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