import React from 'react'; import PropTypes from 'prop-types'; import { Chip, ChipGroup } from '@patternfly/react-core'; export const SelectedChips = ({ selected, setSelected }) => { const deleteItem = itemToRemove => { setSelected(oldSelected => oldSelected.filter(item => item !== itemToRemove) ); }; return ( {selected.map(chip => ( deleteItem(chip)}> {chip} ))} ); }; SelectedChips.propTypes = { selected: PropTypes.array.isRequired, setSelected: PropTypes.func.isRequired, };