Created
July 18, 2017 19:48
-
-
Save johhansantana/7fa183e607d466c80ffcee816d106ddf to your computer and use it in GitHub Desktop.
field for redux-form
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
const renderField = (field) => ( | |
<div className="form-group"> | |
<label htmlFor={field.input.name}>{field.label}</label> | |
<input | |
{...field.input} | |
id={field.input.name} | |
name={field.input.name} | |
className={`form-control ${field.meta.touched && field.meta.error ? 'error' : ''}`} | |
type={field.type} | |
/> | |
{field.meta.touched && field.meta.error && | |
<span className="error">{field.meta.error}</span>} | |
</div> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment