1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 3x 3x | import React from 'react'; import pure from 'recompose/pure'; import PropTypes from 'prop-types'; const Radio = (props) => { return <div> <label> <input type="radio" name={props.name} onChange={(e) => handleOptionChecked(e, props.item)} /> {props.item} </label> </div>; function handleOptionChecked(e, item) { props.onChecked(e, item); } }; Radio.propTypes = { name: PropTypes.string, item: PropTypes.string, onChecked: PropTypes.func, }; export default pure(Radio); |