Skip to content

Instantly share code, notes, and snippets.

@n1te1337
Last active April 25, 2018 19:45
Show Gist options
  • Save n1te1337/238052193fdf444c133d38a6fdccdb5a to your computer and use it in GitHub Desktop.
Save n1te1337/238052193fdf444c133d38a6fdccdb5a 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