import React from 'react'; import PropTypes from 'prop-types'; export default function ItemList(props) { const { items, maxSeen } = props; return ( {items.slice(0, maxSeen).map((item) => ( {item} ))} {items.length > maxSeen && ( ... )} ); } ItemList.propTypes = { items: PropTypes.arrayOf(PropTypes.string).isRequired, maxSeen: PropTypes.number, }; ItemList.defaultProps = { maxSeen: 2, };