Skip to content

Instantly share code, notes, and snippets.

@DanielMSchmidt
Last active May 12, 2016 14:42
Show Gist options
  • Save DanielMSchmidt/e1d38f9e8bad240ea816e2de3fffb602 to your computer and use it in GitHub Desktop.
Save DanielMSchmidt/e1d38f9e8bad240ea816e2de3fffb602 to your computer and use it in GitHub Desktop.
redux-form + autofill
@reduxForm({
form: 'login',
fields: ['email', 'password'],
validate: validation // email and password are both required
})
class LoginForm extends Component {
static propTypes = {
fields: PropTypes.object.isRequired,
handleSubmit: PropTypes.func.isRequired,
}
render() {
const {
handleSubmit,
fields: {
email,
password
}
} = this.props;
return (
<form onSubmit={handleSubmit}>
<Row>
<Input
type="text"
{...email} />
<Input
type="password"
{...password} />
</Row>
<Button type="submit">
...
</Button>
</form>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment