import React, { Component } from 'react';
import PropTypes from 'prop-types';
class Items extends Component {
constructor(props) {
super(props);
this.handClick = this.handClick.bind(this)
}
render() {
const { content } = this.props;
return <div onClick={this.handClick}>
{content}
</div>
}
handClick() {
const { index, handleItemDelete } = this.props;
handleItemDelete(index);
}
Items.propTypes = {
content: PropTypes.arrayOf(PropTypes.string, PropTypes.number),
index: PropTypes.number.isRequired,
handleItemDelete: PropTypes.func
}
}