Created
November 29, 2018 14:08
-
-
Save blizzerand/d2ab4a00b72c11720a317019f88f9534 to your computer and use it in GitHub Desktop.
Select Form Element
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
/*Select.jsx*/ | |
const Select = (props) => { | |
return( | |
<div className="form-group"> | |
<label htmlFor={props.name}> {props.title} </label> | |
<select | |
name={props.name} | |
value={props.value} | |
onChange={props.handleChange} | |
> | |
<option value="" disabled>{props.placeholder}</option> | |
{props.options.map(option => { | |
return ( | |
<option | |
key={option} | |
value={option} | |
label={option}>{option} | |
</option> | |
); | |
})} | |
</select> | |
</div>) | |
} | |
export default Select; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment