Last active
June 8, 2019 02:16
-
-
Save agoiabel/c5f1c1dc9b7e680488908fd2d2fb3e51 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 from 'react'; | |
| const Select = props => { | |
| let formControl = "form-control"; | |
| if (props.touched && !props.valid) { | |
| formControl = 'form-control control-error'; | |
| } | |
| return ( | |
| <div className="form-group"> | |
| <select className={formControl} value={props.value} onChange={props.onChange} name={props.name}> | |
| {props.options.map(option => ( | |
| <option value={option.value}> | |
| {option.displayValue} | |
| </option> | |
| ))} | |
| </select> | |
| </div> | |
| ); | |
| } | |
| export default Select; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment