class DropDownItem extends Component {
constructor(props) {
super(props)
this.state = {
selectedItem : ""
}
this.updateItem = this.updateItem.bind(this)
}
updateItem (item, callback) {
this.setState({selectedItem : item}, callback)
}
render(){
return (
<div>
<DropdownItem onClick={() => {
this.updateItem(this.props.product, ()=>{
console.log("item",this.state.selectedItem)
})
}}
>{this.props.product}</DropdownItem>
<DropdownItem divider/>
</div>
)
}
}