import Select from "react-select"; import PropTypes from "prop-types"; class SelectWithIcon extends React.Component { state = { selectedOption: this.props.selectedIcon }; handleChange = selectedOption => { const { onSelectIcon } = this.props; this.setState({ selectedOption }); if (selectedOption) { onSelectIcon(selectedOption.value); } }; labelWithIcon = iconName => ( {iconName} ); generateOptions = iconList => [ ...iconList.map(iconName => ({ value: iconName, label: this.labelWithIcon(iconName) })) ]; render() { const { iconList } = this.props; const { selectedOption } = this.state; // Generate options object from icon list const options = this.generateOptions(iconList); return (