// Lib
import React, {Component} from 'react';

export default class Select extends Component {

    constructor(props) {
        super(props);
        this.onSelect = this.onSelect.bind(this);
    }

    onSelect(event) {
        const selectedIndex = event.target.options.selectedIndex;
        console.log(event.target.options[selectedIndex].getAttribute('data-key'));
    }

    render() {
        return (
            <div>
                <select onChange={this.onSelect}>
                    <option key="1" data-key="1">One</option>
                    <option key="2" data-key="2">Two</option>
                </select>
            </div>
        );
    }
}