UNPKG

react-jsf

Version:

JSF Compliant React Components

27 lines (23 loc) 661 B
import React from 'react'; import PropTypes from 'prop-types'; import SelectItem from '../objects/SelectItem'; import FSelectItem from './FSelectItem'; export default class FSelectItems extends React.Component { static propTypes = { value: PropTypes.arrayOf(PropTypes.instanceOf(SelectItem)).isRequired, }; render() { const options = this.props.value.map((item, i) => { return <FSelectItem key={i} value={item.value} itemLabel={item.label}/>; }); return ( <React.Fragment> {options} </React.Fragment> ); } } FSelectItems.contextTypes = { getFormId: PropTypes.func, property: PropTypes.func, };