import React from 'react'
export default class ProductList extends React.Component {
constructor(props) {
super()
this.state = { value: -1 }
this.pick = this.pick.bind(this)
}
pick(event) {
const value = Number(event.target.value)
this.setState({ value: value })
if (value === -1) return
const product = this.props.products[value]
this.props.handleSelect(product)
}
render() {
const items = this.props.products.map((product, i) => {
return (
)
})
items.unshift()
return (
)
}
}