class Dropdown1 extends React.component {
onClickHandler(e) {
console.log(e.target.innerText)
}
render() {
return (
<ul>
{[1, 2, 3].map((number, i) =>
<li key={i} onClick={this.onClickHandler}>{number}</li>)
}
</ul>
)}
}
<li>0</li>
<DropDown onClickHandler={yourHandler} data={yourData} />
class Dropdown extends React.component {
render() {
const { data, onClickHandler } = this.props;
return (
<ul>
{data.map((number, i) =>
<li key={i} onClick={onClickHandler}>{number}</li>
)}
</ul>
)}
}