import React from 'react'; import RadioButton from './RadioButton'; class RadioGroup extends React.Component { static propTypes = { children: React.PropTypes.node, className: React.PropTypes.string, disabled: React.PropTypes.bool, name: React.PropTypes.string, onChange: React.PropTypes.func, value: React.PropTypes.any }; static defaultProps = { className: '', disabled: false }; handleChange = (value) => { if (this.props.onChange) this.props.onChange(value); }; renderRadioButtons () { return React.Children.map(this.props.children, (radio, idx) => { return ( ); }); } render () { return (
{this.renderRadioButtons()}
); } } export default RadioGroup;