import React from 'react'; export default class Select extends React.Component { constructor() { super(); this.state = { name: '', value: '', } this.onChange = this.onChange.bind(this); } componentDidMount() { this.setState({ value: this.props.defaultValue }); } componentWillReceiveProps(props) { this.setState({ value: props.defaultValue }); } async onChange(event) { const option = event.target.selectedOptions[0]; this.setState({ name: option.dataset.name, value: event.target.value }); if (this.props.onChange) { this.props.onChange(event); } } render() { return (