Added DropDown.js

This commit is contained in:
Philipp Czora
2018-09-17 14:01:51 +02:00
parent 5687a552b8
commit 2931877c9f

View File

@@ -0,0 +1,25 @@
// @flow
import React from "react";
type Props = {
options: string[],
optionSelected: string => void
}
class DropDown extends React.Component<Props> {
render() {
const {options} = this.props;
return <select onChange={this.change}>
{options.map(option => {
return <option key={option} value={option}>{option}</option>
})}
</select>
}
change = (event) => {
this.props.optionSelected(event.target.value);
}
}
export default DropDown;